Package nl.saxion.gameapp.animation
Class Animatable<T>
java.lang.Object
nl.saxion.gameapp.animation.Animatable<T>
- Direct Known Subclasses:
Interpolator,SpriteAnimation,Timeline,Tween
Represents any object that can be animated or interpolated over time.
This is a common base class for both Interpolator and SpriteAnimation,
allowing them to be updated, reset, and queried for completion in a uniform way.
It is especially useful for composing timelines, sequences, or parallel animations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanChecks whether the animation or interpolation has finished.voidreset()Resets the animation or interpolation to its initial state without reversing.abstract voidreset(boolean reverse) Resets the animation or interpolation to its initial state.abstract Tupdate(float deltaTime) Updates the animation or interpolation by the specified amount of time.
-
Constructor Details
-
Animatable
public Animatable()
-
-
Method Details
-
update
Updates the animation or interpolation by the specified amount of time.This method should be called every frame (e.g., inside your game loop) with the time elapsed since the last update.
- Parameters:
deltaTime- the time in seconds since the last update
-
isFinished
public abstract boolean isFinished()Checks whether the animation or interpolation has finished.For looping animations, this may always return
false.- Returns:
trueif the animation or interpolation has completed,falseotherwise
-
reset
public abstract void reset(boolean reverse) Resets the animation or interpolation to its initial state.Subclasses may implement the
reverseflag to play the animation backward if desired.- Parameters:
reverse- whether to reset in reverse mode (if supported)
-
reset
public void reset()Resets the animation or interpolation to its initial state without reversing.Equivalent to calling
reset(boolean)withreverseset tofalse.
-