BlendShaper
Description
This class takes two Shaper functions and blends them based on a number between 0 and 1. This is useful for creating hybrid shapes, as well as smoothing out other shapes. In practice this is often used for creating less sharp SEAT shapes, for use in zooming.
Example
import megamu.shapetween.*;

Shaper cosine;
BlendShaper blend;

void setup(){
  cosine = new CosineShaper( Shaper.SEAT );
  blend = new BlendShaper( cosine );
}

void draw(){
  beginShape();
  for( float i=0; i<=1; i += 0.05 )
    vertex( i*width, height - blend.shape( i )*height );
  vertex( width, 0);
  endShape();
}

void mouseMoved(){
  float y = norm(mouseY, 0, height);
  blend.setBlend(y);
}
Constructor
BlendShaper( shaperOne )
BlendShaper( shaperOne, shaperTwo )
BlendShaper( shaperOne, blend )
BlendShaper( shaperOne, shaperTwo, blend )
Parameters
shaperOne
Shaper: The first shaper to blend.
shaperTwo
Shaper: The second shaper to blend. If this is not specified a LinearShaper is used.
blend
float: A number between 0 and 1 which interpolates between the two shapers. Default is 0.5.
Methods
setBlend()
Sets the proportion of the two Shapers
getBlend()
Gets the current proportion of the two Shapers
setShaperOne()
Sets the first Shaper
setShaperTwo()
Sets the second Shaper
getShaperOne()
Returns the first Shaper
getShaperTwo()
Returns the second Shaper
Public Variables
blend
Modifys the interpolation between the two Shapers
Related
Shaper