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
|
T |
getFrame(int index)
Returns the frame at a given index
|
int |
getNumberOfFrames()
Returns the total number of frames in this animation
|
float |
getRotation()
Returns the rotation of all frames
|
boolean |
isLooping()
Returns if the animation is looping
|
void |
removeFrame(int index)
Removes a frame from the animation
|
void |
restart()
Restarts the animation.
|
void |
rotate(float degrees)
Increases/decreases the rotation of all frames
|
void |
setLooping(boolean looping)
Sets if the animation should loop
|
void |
setRotation(float rotation)
Sets the rotation of all frames
|
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 getFrame(int index)
index
- The frame's indexpublic 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
framepublic void rotate(float degrees)
degrees
- The amount in degrees to rotate bypublic float getRotation()
public void setRotation(float rotation)
rotation
- The rotation in degreesCopyright © 2014. All rights reserved.