/**try the following keys: nter, alt, arrow keys, shift, s to save image, z, x, c, v **/ int bnum; int a=1; int b; int c=0; int d=0; int e=0; int f=0; int ran1; int ran2; int ran3; int ran4; int ran5; int rancheck; int air; int ranch=5; int cow =0; int cir =0; int move =250; int wait =0; void setup(){ size(500, 500); } void draw(){ //smooth(); wait++; int mx= mouseX -c; int my= mouseY-c; if(mouseX>=250){ mx-=250; } if((mouseX<=250) && (b!=1)){ mx= 250-mouseX; } ran1 = (int)random(255); ran2 = (int)random(255); ran3 = (int)random(255); ran4= (int)random(50); rancheck++; if(rancheck>=ranch){ ran5= (int)random(air); rancheck=0; } mx+=ran5; d++; if(d>250){ e++; } if(e>250){ f++; } if(f>250){ f=50; e=0; d=0; } //noStroke(); fill(ran1,ran2,ran3, ran4); stroke(d,e, f); if(cir==0){ rect(move,a, mx, my); rect(move,a, -mx, my); } else{ ellipse(move,a,mx,my); } if(a>=500){ b=1; } if(a<=0){ b=0; } if(mousePressed&& (b==0 || b==2)){ b=2; } if(!mousePressed && b==2){ b=0; } if(b==0){ a++; c=0; } if(b==4){ b=2; } if(cow==1){ if(ran1>=ran2 && air>=0){ air--; } else { air++; } if(ran2>=ran3 && ranch>=0){ ranch--; } else if(ranch<=10){ ranch++; } if(ran1>=ran3 && move>=0){ move++; } else if(move<=500){ move--; } } if((keyPressed == true) && ((keyCode == ENTER)||(keyCode==RETURN))){ cow=1; } if((keyPressed == true) && (keyCode == ALT)){ cow=0; ranch=5; air=0; } if((keyPressed == true) && (keyCode == SHIFT)){ b=4; } if((keyPressed == true) && (keyCode == RIGHT)){ move++; } if((keyPressed == true) && (keyCode == DOWN)){ cir=0; } if((keyPressed == true) && (keyCode == UP)){ cir=1; } if((keyPressed == true) && (keyCode == LEFT)){ move--; } if((keyPressed == true) && (key == 's')&& (wait>=30)){ saveFrame("pic-####.tif"); wait=0; } if((keyPressed == true) && (key == 'c')){ cir=1; } if((keyPressed == true) && (key == 'v')){ cir=0; } if((keyPressed == true) && (key == 'z')){ move--; } if((keyPressed == true) && (key == 'x')){ move++; } if(b==1){ a-=10; c=1000; d=0; } if(b==2){ a--; } }