setup()
setup() runs once when the sketch first loads. Here it's kept minimal - just building a full-window canvas - because all the interesting state (the balls array) is created dynamically later by clicks.
function setup(){
createCanvas(windowWidth,windowHeight);
}
Line-by-line explanation (1 lines)
createCanvas(windowWidth,windowHeight);- Creates a canvas that exactly matches the current browser window size, so the sketch fills the whole page.