1A
Shape Sandbox
Everything on screen lives at a coordinate. (0,0) is the top-left. Bigger x โ right. Bigger y โ down (yes, down โ computers are weird).
Code โ copy me into the p5.js editor
Demo โ what yours should do
๐ฏ Challenges: move the sun to the other corner ยท give the house two windows ยท add a tree ยท then delete everything and draw your own scene
1B
The Pulse
A variable is just a number with a name. Change the number every frame and the picture comes alive.
Code โ copy me into the p5.js editor
Demo โ what yours should do
๐ฏ Challenges: make it pulse faster ยท make it grow huge before shrinking ยท make the colour change with the size (hint: use the size variable inside fill)
1C
Follow Me
One line of maths makes the ball chase your mouse smoothly. Nobody fully understands this line the first time. That's fine.
Code โ copy me into the p5.js editor
Demo โ move your mouse on it!
๐ฏ Challenges: set speed to 1 โ what happens? ยท set it to 0.01 ยท add a second, slower ball that also chases the mouse (copy the pattern!)