class Nodewalker{ Vec3D position; Node currentNode; Node nextNode; int age; float size; ArrayList nodes; Nodewalker(){ currentNode = new Node(); nextNode = new Node(); position = new Vec3D(); nodes = new ArrayList(); age=0; size=0; } Nodewalker(ArrayList nodes){ this.nodes = nodes; int n = nodes.size(); int selCurrent = constrain((int)random(n),0,n-1); this.currentNode=(Node)this.nodes.get(selCurrent); this.nextNode=this.currentNode.chooseNeighbor(); this.position = new Vec3D(currentNode.position); age=(int)random(10); size=4; } void update(){ if (age<10) position.addSelf(nextNode.position.sub(currentNode.position).scale(0.1f)); if(age==10){ currentNode=nextNode; position = new Vec3D(currentNode.position); nextNode=currentNode.chooseNeighbor(); } if(age>10){ size=0.4f*age; } if(age>20){ size=16-0.4f*age; } if(age>30){ size=4; age=0; } age++; } void draw(){ pushMatrix(); translate(position.x,position.y,position.z); box(size); popMatrix(); } }