A variable is a named box that holds a number. In p5.js, let size = 80 creates a variable called size that starts at 80. Because draw() runs 60 times per second, we can change that number on every frame — and the sketch will animate.
The secret ingredient for smooth, natural motion is sin(). The sine function goes back and forth between −1 and +1 endlessly, like a pendulum. Multiply it and add it to a base value and you get organic-looking breathing or pulsing.
sin(frameCount * 0.05) gives you a slowly oscillating value between −1 and +1. Multiply it by 20 and add it to 80 and you get a number that smoothly drifts between 60 and 100 — a "breathing" size.
The loop for (let i = 0; i < 8; i++) runs the code inside the curly braces 8 times, with i taking the values 0, 1, 2, 3, 4, 5, 6, 7. This is how we draw 8 tentacles without writing the same line 8 times.
cos(angle) and sin(angle) give the x and y offsets on a circle — the same as in trigonometry! TWO_PI is 2π (≈ 6.28), a full circle in radians.
0.05 to 0.1 (faster pulse) or 0.02 (slower). What feels most alive?background(10, 20, 60) with something that uses frameCount.frameCount * 0.05 + 1.5.sin() and a for loop?