plant MyPlant; void setup(){ size(900,400); stroke(157,214,93,160); fill(255,255,255,200); background(175,158,170); MyPlant = new plant(width/2,400); MyPlant.init(); } void draw (){ MyPlant.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>.97) { 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; } }