Here is a simple program.
sketchDownload
function setup() {
createCanvas(300, 300);
background(220);
// text("p5.js vers 0.9.0 test.", 10, 15);
}
function draw() {
if (mouseX < width / 2) { // left side
if (mouseY < height / 2) { // top half
background(255, 0, 0);
}
else { // bottom half
background(0, 255, 0);
}
}
else { // right side
if (mouseY < height / 2) { // top half
background(0, 0, 255);
}
else { // bottom half
background(0, 0, 0);
}
}
}