/* In this example, a circle with random color is drawn whenever the mouse is pressed, with the size of the circle depending on the length of time that the mouse is pressed. */ int r, x, y; // This function is executed only once, at the very beginning void setup() { size(500,400); background(255); fill(128, 128, 255); } // This function is repeatedly call in an implicit loop. // A single call is responsible for drawing a single frame. void draw() { if (r > 0) { // mouse currently pressed r++; ellipse(x, y, r, r); } } void mousePressed() { fill(random(255),random(255),random(255)); r = 1; x = mouseX; y = mouseY; } void mouseReleased() { r = 0; }