/* ####################################################################################### ####################################################################################### ###################### I N S E K T ###################### ###################### by david boardman [dĦĦ] ###################### ###################### http://www.netzfunk.org/?usr=d ###################### ####################################################################################### ####################################################################################### INSTRUCTIONS 1. Press 0 to 9 to change shape 2. Press + or - to modify insekt speed */ int stageSizeX=900, stageSizeY=600; float x, y, vx, vy; float _vol, _spec, _mVol, _mSpec; float osi, osiV; float r, rv, ra, raRange, spd, incrSpd=.5, maxSpd=20, minSpd=3.5; float pos1, pos2, pos3, pos4, rnd; int modeView, num=100, count=0; float mx[] = new float[num]; float my[] = new float[num]; void setup(){ size(stageSizeX,stageSizeY); smooth(); background(255); framerate(90); x=random(stageSizeX); y=random(stageSizeY); modeView=1; vx=x; vy=y; rv=0; ra=0; osi=0; osiV=random(.1,1); //0.1 spd=random(5,12); } void draw(){ smooth(); raRange=random(0.1,1.6); //.1 - 2 osi+=osiV; if(osi > TWO_PI) osi-=TWO_PI; x+=cos(r*PI/360)*spd; y+=sin(r*PI/360)*spd; edgeDetection(); ra=ra*.9+random(-raRange,raRange); rv=rv*.99+ra; r+=rv; fill(255,16); rect(-4,-4,width+4,height+4); for(int i=1; istageSizeX){ x=0; vx-=stageSizeX; } if(y<0){ y=stageSizeY; vy+=stageSizeY; } if(y>stageSizeY){ y=0; vy-=stageSizeY; } } void keyPressed(){ if(key=='1' || key=='2' || key=='3' || key=='4' || key=='5' || key=='6' || key=='7' || key=='8' || key=='9' || key=='0'){ int stK=int(str(key)); if(modeView!=stK){ background(255); modeView=stK; } } if(key=='+'){ if(spd < maxSpd) spd+=incrSpd; } if(key=='-'){ if(spd > minSpd) spd-=incrSpd; } }