- 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
Modifier and TypeFieldDescriptionstatic final long
The default interval for sprite cycling that will be used if none is set. -
Method Summary
Modifier and TypeMethodDescriptiondefault AnimationCallback
callback()
TheAnimationCallback
is a functional interface the methodAnimationCallback.call()
, which will be called after the animation calls the last sprite.int
The column-index of the last sprite to be shown.int
The column-index of the first sprite to be shown.long
The interval for sprite cycling that will be used when playing thisAnimation
.default boolean
loop()
A value that states whether thisAnimation
should loop after it has finished.default Animation
next()
A value that returns the nextAnimation
to be played, after this instance has finished.int
rowEnd()
The row-index of the last sprite to be shown.int
rowStart()
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 thisAnimation
should loop after it has finished. Only aLoopingAnimation
will returntrue
for this value.- Returns:
- whether this
Animation
should loop after it has finished
-
next
A value that returns the nextAnimation
to be played, after this instance has finished. Only aLinkedAnimation
will support this value.- Returns:
- the next
Animation
to be played, after this instance has finished
-
callback
TheAnimationCallback
is 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
-