xxxxxxxxxx
23
let x;
function setup() {
x = false;
createCanvas(600, 400);
}
function draw() {
noStroke();
// show background based on value of buttoncOn
if (x) {
background(255);
} else {
background(0);
}
}
function mousePressed() {
x = !x;
}
// ! means logical NOT. Pressing the mouse makes X become true