toxi.math
Class ExponentialInterpolation
java.lang.Object
toxi.math.ExponentialInterpolation
- All Implemented Interfaces:
- InterpolateStrategy
public class ExponentialInterpolation
- extends java.lang.Object
- implements InterpolateStrategy
Exponential curve interpolation with adjustable exponent. Use exp in the
following ranges to achieve these effects:
- 0.0 < x < 1.0 : ease in (steep changes towards b)
- 1.0 : same as
LinearInterpolation
- > 1.0 : ease-out (steep changes from a)
Method Summary |
float |
interpolate(float a,
float b,
float f)
Implements an interpolation equation. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExponentialInterpolation
public ExponentialInterpolation()
- Default constructor uses square parabola (exp=2)
ExponentialInterpolation
public ExponentialInterpolation(float exp)
- Parameters:
exp
- curve exponent
interpolate
public float interpolate(float a,
float b,
float f)
- Description copied from interface:
InterpolateStrategy
- Implements an interpolation equation.
- Specified by:
interpolate
in interface InterpolateStrategy
- Parameters:
a
- current valueb
- target valuef
- normalized interpolation factor (0.0 .. 1.0)
- Returns:
- interpolated value