float x = 0, y = 0; void setup() { size(400, 400); noStroke(); } void draw() { background(230, 24); // follow the mouse naturally x = lerp(x, mouseX, .05); y = lerp(y, mouseY, .05); // change the color of the circle as it is near the mouse float d = dist(x, y, mouseX, mouseY); if (d < 10) { fill(200, 0, 0); } else { fill(255); } ellipse(x, y, 30, 30); }