// Number of spots int numSpots = 12; // Declare and create an array of spots Spot[] spots = new Spot[numSpots]; String title = "Yay spots!"; void setup(){ size(200, 200); smooth(); noStroke(); for (int i = 0; i < spots.length; i++) { float x = 10 + i*16; float rate = 0.5 + i*0.05; color c = color(random(255), random(255), random(255)); spots[i] = new Spot(x, 50, 10+random(20), rate, c); } } void draw(){ background(0); for(int i =0; i < spots.length; i++){ spots[i].move(); spots[i].changeColor(); spots[i].diameter = 5+random(20); spots[i].display(); } } class Spot { float x; // X-coordinate float y; // Y-coordinate float diameter; // Diameter of circle float speed; // Distance moved each frame int direction = 1; // Direction (1 is down; -1 is up) color col; Spot(float xpos, float ypos, float dia, float s, color c){ x = xpos; y = ypos; diameter = dia; speed = s; col = c; } void display() { fill(col); ellipse(x, y, diameter, diameter); } void move(){ y += (speed * direction); if((y > (height - diameter/2)) || (y < diameter/2)){ direction *= -1; } } // The disappear() method does not do anything until you add code inside of the curl braces {}. void disappear(){} void changeColor(){ col = color(random(255), random(255), random(255)); } }