import processing.core.*; // Uses the Processing library to animate a simple drawing. // The Processing library provides a framework for creating // interactive drawings or animations. public class ProcessingExample extends PApplet { // size of circle to draw private float size = 20.0f; // Called once for initial setup public void setup() { // window size size(500, 500); // set framerate (in frames per second) frameRate(30); // use smooth edges when drawing smooth(); // initial background color background(255); } // Called once per frame public void draw() { // new background to clear old frame fill(100, 100, 100, 20); rect(0, 0, width, height); // If mouse is down, draw a circle if (mousePressed) { fill(255); stroke(255); ellipse(mouseX, mouseY, size, size); // Pick new random by adding or subtracting a // random amount size = size + random(-5.0f, 5.0f); // constrain size to be with interval [5, 80] size = constrain(size, 5, 80); } } public static void main(String[] args) { PApplet.main(new String[] {"ProcessingExample"}); } }