setup()
setup() runs exactly once when the sketch starts, before draw() begins looping. It's the right place to size your canvas and set any starting values, though this sketch has no other state to initialize.
function setup() {
createCanvas(windowWidth, windowHeight);
}
Line-by-line explanation (1 lines)
createCanvas(windowWidth, windowHeight);- Creates a drawing canvas that exactly matches the current width and height of the browser window, so the sketch fills the whole screen.