public class Animation<T extends com.badlogic.gdx.graphics.g2d.Sprite> extends Object
| Constructor and Description |
|---|
Animation()
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFrame(T frame,
float duration)
Adds a frame to the animation
|
void |
draw(Graphics g,
float x,
float y)
Draws the current frame of the animation
|
T |
getCurrentFrame()
Returns the
T of the current frame |
int |
getCurrentFrameIndex()
Returns the index of the current frame
|
int |
getNumberOfFrames()
Returns the total number of frames in this animation
|
boolean |
isLooping()
Returns if the animation is looping
|
void |
removeFrame(int index)
Removes a frame from the animation
|
void |
restart()
Restarts the animation.
|
void |
setLooping(boolean looping)
Sets if the animation should loop
|
void |
update(float delta)
Updates the animation
|
public void addFrame(T frame, float duration)
frame - The frame to be addedduration - The duration of the frame in secondspublic void removeFrame(int index)
index - The index of the frame to be removedpublic void restart()
public void update(float delta)
delta - The time in seconds since the last updatepublic void draw(Graphics g, float x, float y)
g - The Graphics context available for renderingx - The x coordinate to render aty - The y coordinate to render atpublic T getCurrentFrame()
T of the current framepublic int getNumberOfFrames()
public int getCurrentFrameIndex()
public boolean isLooping()
public void setLooping(boolean looping)
looping - False if the animation should stop when it reaches the last
frameCopyright © 2014. All rights reserved.