Mover[] movers = new Mover[300];
Attractor[] attractors = new Attractor[10];
for (int i=0; i<movers.length;i++) {
movers[i] = new Mover(3, random(width), random(height));
for (int j=0; j<attractors.length;j++) {
attractors[j] = new Attractor(10, 0.3, random(width), random(height));
rect(0, 0, width, height);
float p = map(noise(t), 0, 1, -0.05, 0.05);
PVector wind = new PVector(p, 0);
for (int i=0; i< movers.length; i++) {
for (int j=0; j<attractors.length; j++) {
PVector force = attractors[j].attract(movers[i]);
movers[i].applyForce(force);
movers[i].applyForce(wind);
Attractor(float m, float g, float x, float y) {
location = new PVector(x, y);
PVector attract(Mover mover) {
PVector force = PVector.sub(location, mover.location);
float distance = force.mag();
distance = constrain(distance, 15, 25);
float strength = (G * mass * mover.mass) / (distance * distance);
float maxSpeed = random(3, 6);
Mover(float m, float x, float y) {
location = new PVector(x, y);
velocity = new PVector(0, 0);
acceleration = new PVector(0, 0);
void applyForce(PVector force) {
PVector f = PVector.div(force, mass);
velocity.add(acceleration);
velocity.limit(maxSpeed);
ellipse(location.x, location.y, mass, mass);