int phi=1.61725; int dimX=600,dimY=dimX/phi; int numCreatures=30; int maxCreatures=30; Creature[] creatures; int i,j; float amplifier=11; int baseWeight=17; int centerX=dimX/2; int centerY=dimY/2; float xSpeed=random(15)-random(15); float ySpeed=random(15)-random(15); float headWidth=1; color mColor=color(22,22,22,155); void mousePressed(){ amplifier=mouseY/10; baseWeight=mouseX/10; xSpeed=random(15)-random(15); ySpeed=random(15)-random(15); // fill(255,255); // rect(0,0,dimX,dimY); } void keyPressed() { // pressing a key will take a picture if (key=='s'){ saveFrame("output##.png"); } if (key=='c'){ fill(255,255); rect(0,0,dimX,dimY); } if (key=='b'){ mColor=color(0); } if (key=='w'){ mColor=color(255,55); } } void setup() { size(int(dimX),int(dimY),JAVA2D); creatures = new Creature[maxCreatures]; for (j=0;jdimX ) { centerX=dimX; xSpeed*=-1; } if( centerY>dimY ) { centerY=dimY; ySpeed*=-1; } if( centerX<0 ) { centerX=1; xSpeed*=-1; } if ( centerY<0 ){ centerY=1; ySpeed*=-1; } for(j=0;j.95){ thetaIncrement=.05; } thetaMuscle+=thetaIncrement; if(abs(thetaMuscle)>2*PI){ thetaMuscle=0; // amplifier=int(random(20))+15; // baseWeight=int(random(3))+8; // theta*=-1; // stroke(mColor,50); // fill(mColor,50); if (mColor==color(255,55)){ mColor=color(0); } else { mColor=color(255,55); } } else { segs[0].x=headWidth*sin((2*PI*id/numCreatures))+centerX; segs[0].y=headWidth*cos((2*PI*id/numCreatures))+centerY; } //segs[1].x=segs[0].x+sin(PI/180 +thetaMuscle); //segs[1].y=segs[0].y-cos(PI/180+thetaMuscle ); segs[1].x=headWidth*1.1*sin((2*PI*id/numCreatures+thetaMuscle))+centerX; segs[1].y=headWidth*1.1*cos((2*PI*id/numCreatures+thetaMuscle))+centerY; //ellipse(segs[0].x,segs[0].y,segs[0].radius,segs[0].radius); //ellipse(segs[1].x,segs[1].y,segs[1].radius,segs[1].radius); //line(segs[0].x,segs[0].y,segs[1].x,segs[1].y); for(i=2;i999) { if (numCreatures