Package nl.saxion.gameapp.animation
Class Interpolator
Interpolates between two values over time using a specified strategy.
-
Constructor Summary
ConstructorsConstructorDescriptionInterpolator(float start, float end, float duration, com.badlogic.gdx.math.Interpolation strategy) Creates an interpolator with a specific strategy.Interpolator(float start, float end, float duration, String strategyName) Creates an interpolator using a strategy name as a string. -
Method Summary
Modifier and TypeMethodDescriptionstatic String[]Returns all valid string names for interpolation strategies that are supported.floatfloatfloatgetEnd()floatgetStart()booleanFind out if the interpolation has finished.voidreset(boolean reverse) Resets the animation or interpolation to its initial state.update(float deltaTime) Updates the interpolator and returns the current value.Methods inherited from class nl.saxion.gameapp.animation.Animatable
reset
-
Constructor Details
-
Interpolator
public Interpolator(float start, float end, float duration, com.badlogic.gdx.math.Interpolation strategy) Creates an interpolator with a specific strategy.- Parameters:
start- starting valueend- ending valueduration- how long the interpolation takes in secondsstrategy- theInterpolationto use
-
Interpolator
Creates an interpolator using a strategy name as a string. The string is case-insensitive.- Parameters:
start- starting valueend- ending valueduration- how long the interpolation takes in secondsstrategyName- the name of the interpolation strategy
-
-
Method Details
-
update
Updates the interpolator and returns the current value.- Specified by:
updatein classAnimatable<Float>- Parameters:
deltaTime- time since last update (seconds)- Returns:
- current interpolated value
-
isFinished
public boolean isFinished()Find out if the interpolation has finished.- Specified by:
isFinishedin classAnimatable<Float>- Returns:
- True, if the interpolation has finished
-
reset
public void reset(boolean reverse) Description copied from class:AnimatableResets the animation or interpolation to its initial state.Subclasses may implement the
reverseflag to play the animation backward if desired.- Specified by:
resetin classAnimatable<Float>- Parameters:
reverse- whether to reset in reverse mode (if supported)
-
getStart
public float getStart() -
getEnd
public float getEnd() -
getDuration
public float getDuration() -
getElapsed
public float getElapsed() -
getAllInterpolationNames
Returns all valid string names for interpolation strategies that are supported.- Returns:
- array of all interpolation names
-