Main menu

Processingjs

[processingjs]
Node[] node;
int corners = 12;
int nodes = 100;
void setup(){
background(100);
smooth();
size(900,450);
node = new Node[nodes];
for(int i=0;i=0){
PVector dir = new PVector(node[id-1].pos.x,node[id-1].pos.y);
dir.sub(pos);
dir.normalize();
float distance = pos.dist(node[id-1].pos);
dir.mult(distance*distance*.0001);
acc.add(dir);
pos.add(acc);
}
if(id+corners=0){
PVector dir = new PVector(node[id-corners].pos.x,node[id-corners].pos.y);
dir.sub(pos);
dir.normalize();
float distance = pos.dist(node[id-corners].pos);
dir.mult(distance*distance*.0001);
acc.add(dir);
pos.add(acc);
}
}
}
[/processingjs]

FacebookTwitterGoogle+