//import processing.opengl.*; int NUMACTORS = 50; int i = 0; int rNum1, rNum2; int blur=20; boolean released = true; Actor actors[] = new Actor[NUMACTORS]; void setup(){ size(500,500,P3D); reset(); ellipseMode(CENTER_RADIUS); background(0); //smooth(); } void draw(){ noStroke(); fill(0,blur); rect(0,0,width,height); if(keyPressed && released){ switch(key){ case ' ': reset(); break; case 'b': if(blur == 255){ blur = 20; }else{ blur = 255; } break; default: break; } released = false; } for(i = 0; i < NUMACTORS; i++){ actors[i].step(); } } void keyReleased(){ released = true; } void reset(){ for(i = 0; i < NUMACTORS; i++){ actors[i] = new Actor(random(0,width), random(0,height), random(1,10), actors, NUMACTORS); //actors[i].attach((int)random(0,NUMACTORS-1) , (int)random(0,NUMACTORS-1)); actors[i].attach((i+1)%NUMACTORS, (NUMACTORS-(i-1))%NUMACTORS); } } class Actor{ float x,y,m; float vx,vy; float ax,ay; float fx,fy; Actor actors[]; int follow,avoid; int NUMACTORS; float F = .1; float A = 5; float DAMP = .995; int STEPS = 10; float POINTALPHA = 255-100; int POINTCOLOR = 255; float POINTRADIUS = 1.5; Vector aforce = new Vector(0,0); Vector fforce = new Vector(0,0); Actor(float x, float y, float m, Actor[] actors, int NUMACTORS){ this.x=x; this.y=y; this.m=m; this.actors = actors; this.NUMACTORS = actors.length; } void attach(int follow, int avoid){ this.follow = follow; this.avoid = avoid; } void step(){ for(int i = 0; i