+ 2
Could you teach me why this code doesn't run at all?
5 Answers
+ 8
Assuming you're trying to write a p5.js code , here is a p5.js template that you can use.
https://code.sololearn.com/WLM925qWCbFa/?ref=app
And all those lines of code between line 13-25 will go inside the code block
function draw() {
// line 13-25 goes here.
}
+ 6
From where you get this code? And what you want to do with it?
+ 4
1. You need to call function, âdrawâ. Just defining it wonât make it run.
2. Functions like rect(), background(), and all of the drawing functions you used are for Processing JS, not actual JavaScript (I did the same thing a few years ago).
+ 3
Thank you for all the answers! They helped me a lot!
I watched this tutorial ( https://www.khanacademy.org/computing/computer-programming/programming/animation-basics/p/making-animations ) to study javascript and I tried the code out to know how it works then it didn't run at all so I was wondering why it didn't run.
+ 2
Write onload="draw()" in your body tag as an attribute. And also write your function as:
function draw()
And the code is also not correct. That's why it is not running :)