// keyframe interpolation in 2D // Written June 2006 by Jarek Rossignac int nr=8; // number of cars int snr=nr; int snrm=snr*128; car C[] = new car [nr]; // array of cars car SC[] = new car [snrm]; // array of cars car ST[] = new car [snrm]; // array of cars vec I=new vec (1,0); // basis vector for angle calculations vec labelD=new vec(-3,2); // offset vector for painting labels on cars float t=0; // animation time int mode=2; // interpolaiton mode: 0=linear, 1=Bezier, 2=twist boolean showLabels=true, extra=true, inter=true, tweaked=true, mixed=true, animate=true, showControl=true, showCurve=false; color control, derived; int rec=4; float s = 0.5; int curve = 0; float step = 0; float inc=0.5; float back = 2.0; float a = PI/6; void setup(){ size(800, 800); colorMode(HSB,60); control=color(0,60,60); derived=color(20,60,30,30); PFont font = loadFont("Courier-14.vlw"); textFont(font, 12); createCars (); } void createCars () { for (int i=0; i=1.0) {step=0; curve=sn(curve);}; car K = interpolate(SC[curve],step,SC[sn(curve)]); K.paint();} else for (int i=0; i=0; i--) { if (!found) {if(C[i].selected()) { found=true;}; }; }; if (!found) { }; } void mouseDragged() { for (int i=0; i