Package toxi.math
Class ExponentialInterpolation
java.lang.Object
toxi.math.ExponentialInterpolation
- All Implemented Interfaces:
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)
-
Constructor Summary
ConstructorDescriptionDefault constructor uses square parabola (exp=2)ExponentialInterpolation
(float exp) -
Method Summary
Modifier and TypeMethodDescriptiondouble
interpolate
(double a, double b, double f) Implements an interpolation equation using double precision values.float
interpolate
(float a, float b, float f) Implements an interpolation equation using float values.
-
Constructor Details
-
ExponentialInterpolation
public ExponentialInterpolation()Default constructor uses square parabola (exp=2) -
ExponentialInterpolation
public ExponentialInterpolation(float exp) - Parameters:
exp
- curve exponent
-
-
Method Details
-
interpolate
public double interpolate(double a, double b, double f) Description copied from interface:InterpolateStrategy
Implements an interpolation equation using double precision values.- Specified by:
interpolate
in interfaceInterpolateStrategy
- Parameters:
a
- current valueb
- target valuef
- normalized interpolation factor (0.0 .. 1.0)- Returns:
- interpolated value
-
interpolate
public float interpolate(float a, float b, float f) Description copied from interface:InterpolateStrategy
Implements an interpolation equation using float values.- Specified by:
interpolate
in interfaceInterpolateStrategy
- Parameters:
a
- current valueb
- target valuef
- normalized interpolation factor (0.0 .. 1.0)- Returns:
- interpolated value
-