setup()
setup() runs once when the sketch starts. Here it's used to size the canvas to the window and precompute the two colors used for the gradient, so draw() doesn't need to recreate them every frame.
function setup(){
createCanvas(windowWidth,windowHeight);
sky=color(180,220,255);grass=color(90,180,90);
}
Line-by-line explanation (3 lines)
createCanvas(windowWidth,windowHeight)- Creates a canvas that fills the entire browser window, using p5's built-in windowWidth and windowHeight values.
sky=color(180,220,255)- Stores a light blue color in the global variable sky, to be reused every frame for the top of the background gradient.
grass=color(90,180,90)- Stores a green color in the global variable grass, used for the bottom of the background gradient (and visually implying ground).