- All Known Implementing Classes:
FiniteAnimation,FiniteAnimationWithCallBack,LinkedAnimation,LinkedAnimationWithCallBack,LoopingAnimation
public interface Animation
An
Animation encapsulate an animation that uses only a selection of the frames from a sprite sheet.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe default interval for sprite cycling that will be used if none is set. -
Method Summary
Modifier and TypeMethodDescriptiondefault AnimationCallbackcallback()TheAnimationCallbackis a functional interface the methodAnimationCallback.call(), which will be called after the animation calls the last sprite.intThe column-index of the last sprite to be shown.intThe column-index of the first sprite to be shown.longThe interval for sprite cycling that will be used when playing thisAnimation.default booleanloop()A value that states whether thisAnimationshould loop after it has finished.default Animationnext()A value that returns the nextAnimationto be played, after this instance has finished.introwEnd()The row-index of the last sprite to be shown.introwStart()The row-index of the first sprite to be shown.
-
Field Details
-
DEFAULT_AUTOCYCLE_INTERVAL
static final long DEFAULT_AUTOCYCLE_INTERVALThe default interval for sprite cycling that will be used if none is set. This value is in ms.- See Also:
-
-
Method Details
-
rowStart
int rowStart()The row-index of the first sprite to be shown. Note that this value is 0-based.- Returns:
- the 0-based row-index of the first sprite to be shown
-
columnStart
int columnStart()The column-index of the first sprite to be shown. Note that this value is 0-based.- Returns:
- the 0-based column-index of the first sprite to be shown
-
rowEnd
int rowEnd()The row-index of the last sprite to be shown. Note that this value is 0-based.- Returns:
- the 0-based row-index of the last sprite to be shown
-
columnEnd
int columnEnd()The column-index of the last sprite to be shown. Note that this value is 0-based.- Returns:
- the 0-based column-index of the last sprite to be shown
-
loop
default boolean loop()A value that states whether thisAnimationshould loop after it has finished. Only aLoopingAnimationwill returntruefor this value.- Returns:
- whether this
Animationshould loop after it has finished
-
next
A value that returns the nextAnimationto be played, after this instance has finished. Only aLinkedAnimationwill support this value.- Returns:
- the next
Animationto be played, after this instance has finished
-
callback
TheAnimationCallbackis a functional interface the methodAnimationCallback.call(), which will be called after the animation calls the last sprite.- Returns:
- the
AnimationCallback
-
cycleTimeInMs
long cycleTimeInMs()The interval for sprite cycling that will be used when playing thisAnimation.- Returns:
- the interval for sprite cycling that will be used when playing this
Animation
-