xxxxxxxxxx
22
let rectX = 100;
let rectY = 100;
let rectWidth = 200;
let rectHeight = 200;
let rightEdge = rectX + rectWidth;
function setup() {
createCanvas(windowWidth, windowHeight);
}
function draw() {
background(220, 10, 120);
if (mouseX > rectX && mouseX < rightEdge) {
fill(255, 190, 0);
} else {
fill(255);
}
rect(rectX, rectY, rectWidth, rectHeight);
}