/* 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; boolean growing = false; // 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 (mousePressed) { if (!growing) { // time to start anew growing = true; x = mouseX; y = mouseY; r = 0; fill(random(255), random(255), random(255)); } r++; ellipse(x, y, r, r); } else { growing = false; } }