public interface Animatable
An Animatable object is one that may be incorporated into an Animation as one of its frames. Every Animatable object is either a Sprite or an Animation. For simplicity's sake, both Sprites and Animations may be treated as consisting of one or more Animatable frames, indexed by the integers from 0 to getNumFrames() - 1 inclusive, each with its own duration in fracunits. Durations of 0 or less are interpreted as infinite. A Sprite has exactly one frame, namely itself, with a duration of 0.
Animation
Modifier and Type | Method and Description |
---|---|
boolean |
framesAreCompatible(int index1,
int index2)
Returns whether the two frames at the specified indices are compatible
for AnimationInstances' transitioning purposes.
|
Animatable |
getFilteredCopy(Filter filter,
boolean load)
Returns a new Animatable created by applying a Filter to all of the
Sprites of which this Animatable is ultimately composed.
|
Animatable |
getFrame(int index)
Returns this Animatable's frame at the specified index.
|
long |
getFrameDuration(int index)
Returns the duration in fracunits of this Animatable's frame at the
specified index.
|
Drawable |
getInstance()
Returns a Drawable instantiation of this Animatable.
|
int |
getLevel()
Returns how many levels of Animations this Animatable and its frames and
sub-frames comprise.
|
int |
getNumFrames()
Returns how many frames this Animatable has.
|
java.util.Set<Sprite> |
getSprites()
Returns an unmodifiable Set view of all of the Sprites that ultimately
compose this Animatable.
|
int getLevel()
int getNumFrames()
Animatable getFrame(int index)
index
- The index of the frame to be returnedjava.lang.IndexOutOfBoundsException
- if the index is out of rangelong getFrameDuration(int index)
index
- The index of the frame whose duration is to be returnedjava.lang.IndexOutOfBoundsException
- if the index is out of rangeboolean framesAreCompatible(int index1, int index2)
index1
- The index of the first frameindex2
- The index of the second framejava.lang.IndexOutOfBoundsException
- if either of the two indices are out of
rangejava.util.Set<Sprite> getSprites()
Animatable getFilteredCopy(Filter filter, boolean load)
filter
- The Filter to apply to this Animatable's Sprites to create
the new Animatableload
- Whether the new Animatable should load its Sprites upon its
creationDrawable getInstance()