java.lang.Object
org.monte.media.av.Interpolator
org.monte.media.interpolator.AbstractSplineInterpolator
- Direct Known Subclasses:
BezierInterpolator,SplineInterpolator
AbstractSplineInterpolator.- Author:
- Werner Randelshofer
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractSplineInterpolator(boolean reverse) Creates a new interpolator which interpolates into the specified direction within one second.AbstractSplineInterpolator(float startValue, float endValue) Creates a new interpolator which interpolates from the specified start value to the specified end value within one second.AbstractSplineInterpolator(float startValue, float endValue, long timespan) Creates a new interpolator which interpolates from the specified start value to the specified end value within the specified timespan.AbstractSplineInterpolator(long timespan) Creates a new interpolator which interpolates from 0 to 1 within the specified timespan. -
Method Summary
Modifier and TypeMethodDescriptionfinal floatgetFraction(float t) Evaluates the spline function at time t, and clamps the result value between 0 and 1.protected abstract Point2D.FloatgetXY(float t, Point2D.Float p) Evaluates the spline function at curve parameter time t.protected abstract floatgetY(float t) Evaluates the spline function at curve parameter time t.protected voidupdate(float fraction) This method is empty.protected voidupdateFractions(int N) This method must be called by the subclass in the constructor.Methods inherited from class org.monte.media.av.Interpolator
finish, initialize, interpolate, isElapsed, isFinished, isSequential, replaces, setTimespan
-
Constructor Details
-
AbstractSplineInterpolator
public AbstractSplineInterpolator() -
AbstractSplineInterpolator
public AbstractSplineInterpolator(long timespan) Creates a new interpolator which interpolates from 0 to 1 within the specified timespan. -
AbstractSplineInterpolator
public AbstractSplineInterpolator(boolean reverse) Creates a new interpolator which interpolates into the specified direction within one second.- Parameters:
reverse- Set this to true, if you want to interpolate from 1 to 0 instead of from 0 to 1.
-
AbstractSplineInterpolator
public AbstractSplineInterpolator(float startValue, float endValue) Creates a new interpolator which interpolates from the specified start value to the specified end value within one second.- Parameters:
startValue- A value between 0 and 1.endValue- A value between 0 and 1.
-
AbstractSplineInterpolator
public AbstractSplineInterpolator(float startValue, float endValue, long timespan) Creates a new interpolator which interpolates from the specified start value to the specified end value within the specified timespan.- Parameters:
startValue- A value between 0 and 1.endValue- A value between 0 and 1.timespan- A timespan in milliseconds.
-
-
Method Details
-
getFraction
public final float getFraction(float t) Evaluates the spline function at time t, and clamps the result value between 0 and 1.- Overrides:
getFractionin classInterpolator- Parameters:
t- The linear fraction between 0 and 1.- Returns:
- A computed fraction between 0 and 1.
-
getXY
Evaluates the spline function at curve parameter time t. -
getY
protected abstract float getY(float t) Evaluates the spline function at curve parameter time t. -
update
protected void update(float fraction) This method is empty. Subclasses don't have to call super.update(fraction).- Specified by:
updatein classInterpolator- Parameters:
fraction- An interpolated fraction between 0 and 1.
-
updateFractions
protected void updateFractions(int N) This method must be called by the subclass in the constructor.- Parameters:
N-
-