setup()
setup() runs exactly once when the sketch starts, making it the right place to configure the canvas and any drawing defaults (like text alignment and size) that should apply for the rest of the sketch.
function setup(){createCanvas(windowWidth,windowHeight);textAlign(CENTER,CENTER);textSize(20);}
Line-by-line explanation (3 lines)
createCanvas(windowWidth,windowHeight);- Creates a canvas that fills the entire browser window, so the bowl and fish scale to the visitor's screen.
textAlign(CENTER,CENTER);- Sets text alignment so that when text() is called, the string is centered both horizontally and vertically around the given coordinate - important for the dream bubble text.
textSize(20);- Sets the default font size in pixels for any text drawn later in draw().