import megamu.shapetween.*;
Shaper cosine;
void setup(){
  size(200,200);
  cosine = new CosineShaper(Shaper.IN);
}
void draw(){
  background(255);
  beginShape();
  for( float i=0; i<=1; i+= 0.05 )
    vertex( i*width, cosine.shape( i )*height );
  endShape();
  beginShape();
  for( float i=0; i<=1; i+= 0.05 )
    vertex( i*width, cosine.slope( i )*height );
  endShape();
  stroke(255,0,0);
  float x = norm( mouseX, 0, width );
  float y = cosine.shape( x );
  float m = cosine.slope( x );
  float n = cosine.secondSlope( x );
  line(width*(x-1), height*(y-m), width*(x+1), height*(y+m));
  line(width*(x-1), height*(m-n), width*(x+1), height*(m+n));
}