ArrayList movers = new ArrayList(); void setup(){ size(400,400); for(int i = 0; i < 10; i++){ movers.add(new Mover()); } } void draw(){ fill(0,1); rect(0,0,width,height); fill(255); for(Mover m : movers){ m.move(); m.draw(); } } float ACCEL = .12; class Mover { float x,y; float xs,ys; float sz; Mover(){ x = random(width); y = random(height); xs = random(-5,5); ys = random(-5,5); } void move(){ if(x < mouseX) xs += ACCEL; else xs -= ACCEL; if(y < mouseY) ys += ACCEL; else ys -= ACCEL; x = x + xs; y = y + ys; xs *= .999; ys *= .999; sz = abs(20 - dist(0,0,xs,ys) * 10); } void draw(){ ellipse(x,y,sz,sz); } }