//Left click to move the dot using the current interpolation method //Right click to change the interpolation method Smoothing s=new Smoothing(); PFont f; float x=10,y=10,nx=10,ny=10; float maxTime=1000; float startTime=0; void setup(){ size(400,400); smooth(); f=loadFont("font.vlw"); textFont(f,32); textAlign(CENTER); background(255); smooth(); } int type=0; void draw(){ fill(255,50); noStroke(); rect(0,0,width,height); drawFunction(type); fill(0); ellipse( s.interpolate(type,x,nx,(millis()-startTime),maxTime), s.interpolate(type,y,ny,(millis()-startTime),maxTime), 5,5 ); text(s.nameForFn(type),width/2,height-20); } void mousePressed(){ if(mouseButton==RIGHT){ type++; if(type>=s.count) type=0; } else{ background(255); x=s.interpolate(type,x,nx,(millis()-startTime),maxTime); y=s.interpolate(type,y,ny,(millis()-startTime),maxTime); nx=mouseX; ny=mouseY; startTime=millis(); } } void drawFunction(int which){ stroke(128); noFill(); rect(0,0,100,100); //flip axes pushMatrix(); scale(1,-1); translate(0,-100); //draw curve stroke(0); for(float i=1;i