functiondraw(n){ C.setBackgroundColor(1,1,1); C.setpenWeight(.1) C.setpenColor(1,0,0); for(h=.01;h<.5;h+=.1){ C.drawOval(false,.5,.5,h,h); } varA=newArray(1-(n_count/n_duration),.25+(n_count/(n_duration*2))); //move arrow position each frame with a scale of .5 if(1-(n/n_duration)>.8){ //at the start draw a line to the edge of the page offpage_character(C,A); }
else{ if(1-(n/n_duration)>.5){// then animate character moving_character(C,A,scalex,scaley); } else{//then stop the character in the bullseye still_character(C,scalex,scaley); } } }
functionoffpage_character(C,A){ C.setpenColor(0,0,0); C.setpenWeight(.05); C.drawLine(A[0],A[1],1,.25);//draw arrow feather(C,A,scalex,scaley);//add feather at end eyes(C,A,scalex,scaley);// add 2 eyes mouth(C,A,scalex,scaley);//add a mouth nose(C,A,scalex,scaley);//add a nose }
functionstill_character(C,scalex,scaley){ varbullseye=newArray(.5,.5); C.setpenColor(0,0,0); C.setpenWeight(.01); C.drawLine(.47,.48,.52,.54);//draw arrow C.setpenWeight(.05); C.drawLine(bullseye[0],bullseye[1],bullseye[0]+scalex,bullseye[1]-scaley); C.setpenWeight(.01); varx=bullseye[0]+scalex;//set starting point for feathers from old ending point on the line for x vary=bullseye[1]-scaley;//and for y vart=scalex/20; varu=scaley/20; for(r=-5;r<0;r+=.5){//draw feathers C.drawLine(x+(t*r),y-(u*r),x+(t*r)+.05,y-(u*r));// ensure feather angle matches shaft angle C.drawLine(x+(t*r),y-(u*r),x+(t*r),y-(u*r)-.05);// by using a multiple of scalex and scaley C.drawLine(x+(t*r),y-(u*r),x+(t*r)+.03,y-(u*r)-.03);//for translating } C.setpenWeight(scalex/2); C.setpenColor(1,1,1); varx=bullseye[0]+(scalex/2);// draw eyes from midpoint of arrow for x vary=bullseye[1]-(scaley/2);// and y C.drawLine(x+.01,y+.01,x+.011,y+.01);//use glitch for eyeballs C.drawLine(x-.01,y-.01,x-.011,y-.01); C.setpenWeight(scalex/4); C.setpenColor(0,0,0); C.drawLine(x+.01,y+.01,x+.0105,y+.01);//use glitch again C.drawLine(x-.01,y-.01,x-.0105,y-.01); vara=bullseye[0]+(((.3+scalex)-.3)/4);//draw mouth a guarter from the bottom of arrow for x varb=bullseye[1]-((.6-(.6-scaley))/4);// and y C.setpenWeight(scalex/6); C.setpenColor(0,0,0); C.drawLine(a-scalex/10,b-scaley/10,a+scalex/10,b+scaley/10); C.setpenWeight(scalex/30); C.setpenColor(1,1,1); C.drawLine(a-scalex/10,b-scaley/10,a+scalex/10,b+scaley/10); varm=bullseye[0]+(scalex/2.5);//draw nose a little less than 1/2 the way up the arrow vars=bullseye[1]-(scaley/2.5); C.setpenWeight(scalex/3); C.setpenColor(0,0,1); C.drawLine(m,s,m+.005,s); }
functionmoving_character(C,A,scalex,scaley){ C.setpenColor(0,0,0); C.setpenWeight(.05); C.drawLine(A[0],A[1],A[0]+scalex,A[1]-scaley);//draw arrow shaft feather(C,A,scalex,scaley);//add feather at end eyes(C,A,scalex,scaley);// add 2 eyes mouth(C,A,scalex,scaley);//add a mouth nose(C,A,scalex,scaley);//add a nose
}
//draw end feather functionfeather(C,A,scalex,scaley){ C.setpenWeight(.01); varx=A[0]+scalex;//set starting point from old ending point on the line for x vary=A[1]-scaley;//and for y vart=scalex/20; varu=scaley/20; for(r=-5;r<0;r+=.5){ C.drawLine(x+(t*r),y-(u*r),x+(t*r)+.05,y-(u*r));// ensure feather angle matches shaft angle C.drawLine(x+(t*r),y-(u*r),x+(t*r),y-(u*r)-.05);// by using a multiple of scalex and scaley C.drawLine(x+(t*r),y-(u*r),x+(t*r)+.03,y-(u*r)-.03);//for translating } }
//draw eyes functioneyes(C,A,scalex,scaley){ C.setpenWeight(scalex/2); C.setpenColor(1,1,1); varx=A[0]+(scalex/2);// draw eyes from midpoint of arrow for x vary=A[1]-(scaley/2);// and y C.drawLine(x+.01,y+.01,x+.011,y+.01);//use glitch for eyeballs C.drawLine(x-.01,y-.01,x-.011,y-.01); C.setpenWeight(scalex/4);// size of eyes based on scale C.setpenColor(0,0,0); C.drawLine(x+.01,y+.01,x+.0105,y+.01);//use glitch again C.drawLine(x-.01,y-.01,x-.0105,y-.01); }
//draw mouth functionmouth(C,A,t,u){ varx=A[0]+(t/4);//draw mouth a guarter from the bottom of arrow for x vary=A[1]-(u/4);// and y C.setpenWeight(t/6);// size of mouth based on scale C.setpenColor(0,0,0); C.drawLine(x-t/10,y-u/10,x+t/10,y+u/10); C.setpenWeight(t/30);// size of mouth based on scale C.setpenColor(1,1,1); C.drawLine(x-t/10,y-u/10,x+t/10,y+u/10); }
//draw nose functionnose(C,A,scalex,scaley){ varx=A[0]+(scalex/2.5); vary=A[1]-(scaley/2.5); C.setpenWeight(scalex/3); C.setpenColor(0,0,1); C.drawLine(x,y,x+.005,y); }