public abstract class Interpolator
extends java.lang.Object
Constructor and Description |
---|
Interpolator()
Creates a new interpolator which interpolates from 0 to 1 within one
second.
|
Interpolator(boolean reverse)
Creates a new interpolator which interpolates into the specified
direction within one second.
|
Interpolator(float startValue,
float endValue)
Creates a new interpolator which interpolates from the specified
start value to the specified end value within one second.
|
Interpolator(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.
|
Interpolator(long timespan)
Creates a new interpolator which interpolates from 0 to 1 within the
specified timespan.
|
Modifier and Type | Method and Description |
---|---|
void |
finish(long currentTimeMillis)
Finishes the interpolation and calls this.notifyAll() allowing other
threads to synchronize on isFinished() of the interpolator.
|
protected float |
getFraction(float linearFraction)
Computes a fraction from the specified linear fraction.
|
void |
initialize(long currentTimeMillis)
Initializes the interpolation.
|
void |
interpolate(long currentTimeMillis)
Interpolates with the current time millis.
|
boolean |
isElapsed(long currentTimeMillis)
Returns true, if the timespan of the Interpolator has elapsed since
initialize was called.
|
boolean |
isFinished() |
boolean |
isSequential(Interpolator that) |
boolean |
replaces(Interpolator that)
Returns true, if this interpolator replaces
interpolations by that interpolator.
|
void |
setTimespan(long t) |
protected abstract void |
update(float fraction)
Updates the interpolator.
|
public Interpolator()
public Interpolator(long timespan)
public Interpolator(boolean reverse)
reverse
- Set this to true, if you want to interpolate from 1 to 0
instead of from 0 to 1.public Interpolator(float startValue, float endValue)
startValue
- A value between 0 and 1.endValue
- A value between 0 and 1.public Interpolator(float startValue, float endValue, long timespan)
startValue
- A value between 0 and 1.endValue
- A value between 0 and 1.timespan
- A timespan in milliseconds.protected abstract void update(float fraction)
fraction
- An interpolated fraction between 0 and 1.protected float getFraction(float linearFraction)
linearFraction
- The linear fraction between 0 and 1.public boolean replaces(Interpolator that)
public void initialize(long currentTimeMillis)
Once this method has been called, method #finish must be called before the interpolator can be destroyed.
currentTimeMillis
- public boolean isElapsed(long currentTimeMillis)
currentTimeMillis
- The current time.public void interpolate(long currentTimeMillis)
currentTimeMillis
- public void finish(long currentTimeMillis)
currentTimeMillis
- public boolean isFinished()
public boolean isSequential(Interpolator that)
public void setTimespan(long t)