xxxxxxxxxx
24
const PANES = 3;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
for (let i = 1; i <= PANES; i++) {
const rightBoundary = i*width/PANES;
const leftBoundary = (i-1)*width/PANES;
// print(rightBoundary);
// print(leftBoundary);
if (mouseX < rightBoundary && mouseX > leftBoundary) {
strokeWeight(0);
fill(255, 0, 0);
rect(leftBoundary, 0, width/PANES, height);
}
strokeWeight(1);
line(i*width/PANES, 0, i*width/PANES, height);
}
}