public class Animation extends java.lang.Object implements IUpdateable, ILaunchable
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_FRAME_DURATION |
Constructor and Description |
---|
Animation(Spritesheet spritesheet,
boolean loop,
boolean randomizeStart,
int... keyFrameDurations) |
Animation(Spritesheet spritesheet,
boolean loop,
int... keyFrameDurations) |
Animation(java.lang.String spriteSheetName,
boolean loop,
boolean randomizeStart,
int... keyFrameDurations) |
Animation(java.lang.String name,
Spritesheet spritesheet,
boolean loop,
boolean randomizeStart,
int... keyFrameDurations) |
Animation(java.lang.String name,
Spritesheet spritesheet,
boolean loop,
int... keyFrameDurations) |
Modifier and Type | Method and Description |
---|---|
KeyFrame |
getCurrentKeyFrame() |
java.util.List<KeyFrame> |
getKeyframes() |
java.lang.String |
getName() |
Spritesheet |
getSpritesheet() |
int |
getTotalDuration()
Gets to aggregated duration of all
KeyFrame s in this animation. |
boolean |
isLoop() |
boolean |
isPaused() |
boolean |
isPlaying() |
void |
pause() |
void |
restart() |
void |
setFrameDuration(int frameDuration)
Sets the frame duration for all keyframes in this animation to the
specified value.
|
void |
setkeyFrameDurations(int... keyFrameDurations) |
void |
start()
Starts the operation of this instance.
|
void |
terminate()
Terminates the operation of this instance.
|
void |
unpause() |
void |
update()
This method is called by the game loop on all objects that need to update
their attributes.
|
public static final int DEFAULT_FRAME_DURATION
public Animation(java.lang.String spriteSheetName, boolean loop, boolean randomizeStart, int... keyFrameDurations)
public Animation(Spritesheet spritesheet, boolean loop, boolean randomizeStart, int... keyFrameDurations)
public Animation(Spritesheet spritesheet, boolean loop, int... keyFrameDurations)
public Animation(java.lang.String name, Spritesheet spritesheet, boolean loop, boolean randomizeStart, int... keyFrameDurations)
public Animation(java.lang.String name, Spritesheet spritesheet, boolean loop, int... keyFrameDurations)
public KeyFrame getCurrentKeyFrame()
public java.util.List<KeyFrame> getKeyframes()
public int getTotalDuration()
KeyFrame
s in this animation.public java.lang.String getName()
public Spritesheet getSpritesheet()
public boolean isLoop()
public boolean isPaused()
public boolean isPlaying()
public void pause()
public void setFrameDuration(int frameDuration)
frameDuration
- The frameduration for all keyframes.public void setkeyFrameDurations(int... keyFrameDurations)
public void start()
ILaunchable
start
in interface ILaunchable
public void restart()
public void terminate()
ILaunchable
terminate
in interface ILaunchable
public void unpause()
public void update()
IUpdateable
update
in interface IUpdateable