class Violet { float x, y, w, speed, a; Violet (float x_, float y_, float w_, float speed_, float a_) { x = x_; y = y_; w = w_; speed = speed_; a = a_; } void displayv () { noStroke (); fill (255,0,243, a); ellipse (x,y,w,w); } void movev () { x += r * cos(theta); y += r * sin(theta); theta -= 0.001; if (random(1.0) < 0.04) { r += .001; } x = x + random( - 10,10); y = y + random( - 10,10); x = constrain (x,0,width); y = constrain (y,0,height); a = a ++; if (a > 100) { a-=40; } else if (a < 20) { a+=40; } } void bouncev () { if ( y < 1 || y> (height-1) || x < 1 || x > (width-1)) { speed = speed * - 0.95; } if (buttonv) { if (random(1.0) < 0.02) { Violet vs = new Violet(random(300,320), random(410,420), random(3,6), random(6), random (150,70)); violets = (Violet []) append (violets, vs); } } } }