Package snap.util
Class Interpolator
java.lang.Object
snap.util.Interpolator
This class provides functionality to interpolate between two numbers given a ratio between 0-1.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic Interpolator
Ease Both interpolator.static Interpolator
Ease In interpolator.static Interpolator
Ease Out interpolator.static Interpolator
Linear interpolator. -
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a new interpolator with given direction. -
Method Summary
Modifier and TypeMethodDescriptionstatic Interpolator
getInterpolator
(int anIndex) Returns the individual common interpolator at given index.static Interpolator
getInterpolator
(String aName) Returns a shared interpolator for given name.static int
Returns number of shared common interpolators.getName()
Returns the name of this interpolator.protected double
getRatio
(double aRatio) Returns a new ratio given normal ratio.double
getValue
(double aRatio, double aStart, double anEnd) Returns a value given a ratio and start/end values.protected double
interp
(double aRatio, double aStart, double aEnd) Direction In interpolation.protected double
interpBoth
(double aRatio, double aStart, double anEnd) Direction Both interpolation.protected double
interpOut
(double aRatio, double aStart, double aEnd) Direction Out interpolation.toString()
Returns a string representation of this interpolator.
-
Field Details
-
LINEAR
Linear interpolator. -
EASE_IN
Ease In interpolator. -
EASE_OUT
Ease Out interpolator. -
EASE_BOTH
Ease Both interpolator.
-
-
Constructor Details
-
Interpolator
Creates a new interpolator with given direction.
-
-
Method Details
-
getName
Returns the name of this interpolator. -
getValue
public double getValue(double aRatio, double aStart, double anEnd) Returns a value given a ratio and start/end values. -
getRatio
protected double getRatio(double aRatio) Returns a new ratio given normal ratio. -
interp
protected double interp(double aRatio, double aStart, double aEnd) Direction In interpolation. -
interpOut
protected double interpOut(double aRatio, double aStart, double aEnd) Direction Out interpolation. -
interpBoth
protected double interpBoth(double aRatio, double aStart, double anEnd) Direction Both interpolation. -
toString
Returns a string representation of this interpolator. -
getInterpolatorCount
public static int getInterpolatorCount()Returns number of shared common interpolators. -
getInterpolator
Returns the individual common interpolator at given index. -
getInterpolator
Returns a shared interpolator for given name.
-