// UdK Computational design // Marius Watz 2003 // http://www.evolutionzone.com/udk/ // // UDK03_03_mouse_events // // Using mouse event handlers. float x,y,rad; void setup() { size(400,400); ellipseMode(CENTER_DIAMETER); x=0; y=0; rad=10; } void loop() { background(200,200,200); fill(255,0,0); ellipse(x,y, rad,rad); } // Gets called every time the mouse is moved and the mouse button // is not pressed. void mouseMoved() { x=mouseX; y=mouseY; } // Gets called once when the mouse button is clicked. void mousePressed() { rad+=10; if(rad>100) rad=10; } // Gets called every time the mouse is moved and the mouse button // is pressed. void mouseDragged() { rad+=1; if(rad>100) rad=10; x=mouseX; y=mouseY; }