int cx, cy, r; void setup() { size(300,300); background(255); ellipseMode(RADIUS); cx = 150; cy = 150; r = 30; } void draw() { clearToWhite(); stroke(0); fill(255); ellipse(cx, cy, r, r); } void clearToWhite() { fill(255,70); noStroke(); rect(0,0,width,height); } void mouseDragged() { float d = sqrt((cx - mouseX) * (cx - mouseX) + (cy - mouseY) * (cy - mouseY)); if( d < r ) { cx = mouseX; cy = mouseY; } }