papermache
YaBB Newbies
Offline
Posts: 1
help with an animation
Oct 19th , 2007, 3:41am
hey guys im very new to processing and i have an assignment to make. it's basically a little animated show using mouseX to "animate" it. as the mouse moves across the window and is positioned in a specific place, a new picture is supposed to show up. i did that for the first part of my animation and it was fine. however, i now want to show another animation as the mouse moves backwards...how would i do that??? my prof. said something about using a Boolean, but i dont know...heres what i have so far: ___________________________________ PImage e1; PImage e2; PImage e3; PImage e4; PImage e5; PImage e6; PImage e7; PImage e8; PImage e9; PImage e10; PImage e11; PImage e12; PImage e13; PImage e14; PFont myFont; void setup() { size(600,400); background(255); frameRate(100); myFont=loadFont("STXihei-48.vlw"); textFont(myFont); e1= loadImage("egg1.png"); e2= loadImage("egg2.png"); e3= loadImage("egg3.png"); e4= loadImage("egg4.png"); e5= loadImage("egg5.png"); e6= loadImage("egg6.png"); e7= loadImage("egg7.png"); e8= loadImage("egg8.png"); e9= loadImage("egg9.png"); e10= loadImage("egg10.png"); e11= loadImage("egg11.png"); e12= loadImage("egg12.png"); e13= loadImage("egg13.png"); e14= loadImage("egg14.png"); } void draw() { float normX = norm(mouseX,0,width); int which = int(lerp(0,14,normX)); println(which); if (which==0) { background(255); image(e1,width/4.7,height/16,300,375); }else if (which==1) { background(255); image(e2,width/5,height/16,350,375); }else if (which==2) { background(255); image(e3,width/4,45,280,350); }else if (which==3) { background(255); image(e4,width/4,45,280,350); }else if (which==4) { background(255); image(e5,width/5,54,280,350); }else if (which==5) { background(255); image(e6,width/3.7,50,280,350); }else if (which==6) { background(255); image(e7,width/4,50,280,350); }else if (which==7) { background(255); image(e8,width/3.7,50,280,350); }else if (which==8) { background(255); image(e9,width/4,45,325,360); }else if (which==9) { background(255); image(e10,width/3.7,42,285,360); }else if (which==10) { background(255); image(e11,width/3.7,42,285,360); }else if (which==11) { background(255); image(e12,width/3.7,42,290,360); }else if (which==12) { background(255); image(e13,width/3.7,42,285,360); }else if (which==13) { background(255); image(e14,width/3.7,44,298,360); textFont(myFont); textSize(30); fill(250,20,80); text("the egg came first!",25,150); } } ____________________________________________ please help me.