int x,y; void setup(){ size(200,200); rectMode(CORNER); } void draw(){ background(230); x=mouseX-100; y=mouseY-100; rect(100,100,x,y); }