class Line{ private float posx, posy; private float angle; private float dev; private float speed; private int hued; Line(float x, float y, int h){ posx = x; posy = y; angle = random(0,PI*2); dev = random(-PI*0.01,PI*0.01); hued = (h + ((int) random(-10,10))) % 255; } void Move(){ dev *= 0.99; angle += dev; float dirx = cos(angle); float diry = sin(angle); posx += dirx; posy += diry; colorMode(HSB,255); fill(hued,192,192,32); noStroke(); ellipse(posx,posy,weight,weight); if ((posx < 0) || (posx > width) || (posy < 0) || (posy > height) ) lines.remove(lines.indexOf(this)); } void Event(){ lines.remove(lines.indexOf(this)); if (((lines.size()<2) || (random(100)<50)) && (lines.size()<15) ) { lines.add(new Line(posx,posy,hued+5)); lines.add(new Line(posx,posy,hued-5)); } } }