Plant[] c = new Plant[10]; int ix = 30; //xlocation of plants int space = 120; //space in between each different plant origin int fadeCounter = 0; void setup() { size(900,400); background (58, 137, 208); stroke (117,250,3,80); for(int i=0; i<10; i++) { c[i] = new Plant(ix,400); c[i].init(); ix = ix + space; } framerate(30); } void draw() { // fade //println(fadeCounter+ "=="+ fadeCounter++%60); if(fadeCounter++%60==0) { noStroke(); fill(150,150,150,10); rect(0,0,width,height); stroke(130,255,30,80); fill(236,242,227); } for(int i=0;i<10;i++) { for(int j=0;j<1;j++) { c[i].run(); } } } // class class Plant { int count, index; float x,y,rnd,angle,x1,y1,v,speed; float timer,end; float originX; float originY; // Vector class Vector points = new Vector(); Plant(int _x,int _y) { x = _x; y = _y; originX = _x; originY = _y; } void init() { angle = (random(1)*(2*PI))-PI; x1 = x; y1 = y; v = 0; speed = 1.5; count = 0; timer = 0; end = random(100); } void run() { x += cos(angle)*speed; y += sin(angle)*speed; //flowers rnd = random(1); if(rnd>.07) { for(int i=0;iwidth || x<0 || y>height || y<0 || timer>end) { index = int(random(1)*points.size()); Point tmpElement = (Point)points.elementAt(index); //Returns the component at the specified index x = tmpElement.x; y = tmpElement.y; angle = (random(1)*(2*PI))-PI; timer = 0; end = random(500); } x1 = x; y1 = y; } } class Point { float x,y; float angle; Point(float theX,float theY,float theAngle) { x = theX; y = theY; angle = ((random(1)*(2*PI))-PI); //theAngle; } }