ArrayList<Bridge> bridges = new ArrayList<Bridge>();
void setup(){
size(500, 500);
smooth();
frameRate(24);
bridges = new ArrayList<Bridge>();
for(int i = 0; i < 30; i++){
bridges.add(new Bridge());
}
}
void draw(){
background(0);
noFill();
stroke(255);
strokeWeight(1);
translate(width/2, height/2);
for(Bridge bridge: bridges){
bridge.drawMe();
}
}
class Bridge{
float radianSpeed1;
float radianSpeed2;
Bridge(){
radianSpeed1 = map(random(1), 0, 1, PI / 32, PI / 8);
radianSpeed2 = map(random(1), 0, 1, PI / 32, PI / 8);
}
void drawMe(){
float radian1 = radianSpeed1 * frameCount * 0.1;
PVector p1 = new PVector(cos(radian1), sin(radian1));
p1.mult(150);
float radian2 = radianSpeed2 * frameCount * 0.1;
PVector p2 = new PVector(cos(radian2), sin(radian2));
p2.mult(150);
ellipse(p1.x, p1.y, 10, 10);
ellipse(p2.x, p2.y, 10, 10);
line(p1.x, p1.y, p2.x, p2.y);
}
}