MouseX Fill. Using p5.js library.
function setup() {
createCanvas(640, 360);
}
function draw() {
background(0);
stroke(255);
strokeWeight(4);
noFill();
if (mouseX > 320) {
fill(255, 0, 0);
}
ellipse(320, 180, 100, 100);
line(320, 0, 320, 100);
fill(255);
noStroke();
textSize(24);
text('← if statement fills circle red', 325, 40);
text('once cursor reaches', 350, 70);
text('320 pixels along x axis', 350, 100);
}