xxxxxxxxxx
26
let bgColorIndex = 0;
function setup() {
createCanvas(windowWidth, windowHeight);
background(220, 20, 120);
noLoop();
}
function draw() {}
function mouseClicked() {
if (bgColorIndex == 0) {
bgColorIndex = 1;
background("gold");
} else if (bgColorIndex == 1) {
bgColorIndex = 2;
background("darkgreen");
} else if (bgColorIndex == 2) {
bgColorIndex = 3;
background("darkblue");
} else if (bgColorIndex == 3) {
bgColorIndex = 0;
background(220, 20, 120);
}
}