p5 js functions 1

p5 js functions

p5js.org

Here is what the above code is Doing:
1. Create a canvas
2. Create a variable called “x” and set it to 0
3. Create a variable called “speed” and set it to 1
4. Create a function called “draw”
5. Inside the draw function, draw a circle at the x position
6. Inside the draw function, increase the x position by the speed
7. Inside the draw function, if the x position is greater than the width of the canvas, set the x position to 0

Similar Posts