xxxxxxxxxx
30
function setup() {
createCanvas(600, 400);
}
function draw() {
background(220);
// if mouse
if (mouseX < 200) {
fill("red");
rect((width / 3) * 0, 0, width / 3, height);
noFill();
rect((width / 3) * 1, 0, width / 3, height);
rect((width / 3) * 2, 0, width / 3, height);
}else if (mouseX < 400) {
noFill();
rect((width / 3) * 0, 0, width / 3, height);
fill("red");
rect((width / 3) * 1, 0, width / 3, height);
noFill();
rect((width / 3) * 2, 0, width / 3, height);
} else {
noFill();
rect((width / 3) * 0, 0, width / 3, height);
rect((width / 3) * 1, 0, width / 3, height);
fill("red");
rect((width / 3) * 2, 0, width / 3, height);
}
}