/* In this example, the canvas is painted with a trail of circles whenever the mouse is pressed/dragged. Pressing any key causes a new random fill color to be selected, and displayed at bottom. */ // This function is executed only once, at the very beginning void setup() { size(500,400); background(255); fill(random(255), random(255), random(255)); } // This function is repeatedly call in an implicit loop. // A single call is responsible for drawing a single frame. void draw() { rect(0,height-10,width,height-10); // display current fill color } void mouseDragged() { ellipse(mouseX, mouseY, 20, 20); } void keyPressed() { fill(random(255), random(255), random(255)); }