// redFrik //click to explode //import processing.opengl.*; //better quality int maxNumAgents= 50; int numAgents= 50; Agent[] agents= new Agent[maxNumAgents]; float rotX= 0, rotY= 0, rotZ= 0, rx, ry, rz; int tx, ty, tz; float sx, sy, sz, sxDrift, syDrift, szDrift; void setup() { size(640, 480, P3D); //size(640, 480, OPENGL); //better quality framerate(30); background(150, 150, 120); initAgents(); newTrans(); newScale(); newRotation(); } void draw() { translate(width/2+tx, height/2+ty, tz); sx= sx+sxDrift; sy= sy+syDrift; sz= sz+szDrift; scale(sx, sy, sz); rotX= rotX+radians(rx); rotateX(rotX); rotY= rotY+radians(ry); rotateY(rotY); rotZ= rotZ+radians(rz); rotateZ(rotZ); for(int i= 0; i7) { sx= random(0.6, 1.2); sy= random(0.6, 1.2); sz= random(0.1, 2); if(random(0, 10)>8) {sxDrift= random(-0.1, 0.1);} else {sxDrift= 0;} if(random(0, 10)>8) {syDrift= random(-0.1, 0.1);} else {syDrift= 0;} if(random(0, 10)>8) {szDrift= random(-0.1, 0.1);} else {szDrift= 0;} } else { sxDrift= 0; syDrift= 0; szDrift= 0; if(random(0, 10)>5) { sx= random(0.3, 0.7); sy= random(0.2, 0.6); sz= random(0.01, 0.25); } else { sx= 1; sy= 1; sz= 1; } } } void newRotation() { rx= ry= rz= 0; rotX= rotY= rotZ= 0; if(random(0, 10)>7) { ry= random(-4, 4); } if(random(0, 10)>7) { rz= random(-4, 4); } if(random(0, 10)>4) { rx= random(-4, 4); } if(rx+ry+rz==0) { //make sure always some rotation rx= random(0.5, 3); } }