xxxxxxxxxx
25
let isRed = false;
let hasleft = true;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
if(mouseX > 200) {
if(hasLeft) {
isRed = !isRed;
hasLeft = false;
}
}
else {
hasLeft = true;
}
if(isRed) {
fill('red');
rect(200,0,200,400);
}
}