public class Animation<T extends Sprite>
extends java.lang.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)
Draws the current frame of the animation 
 | 
void | 
draw(Graphics g,
    float x,
    float y)
Draws the current frame of the animation 
 | 
void | 
flip(boolean flipX,
    boolean flipY)
Sets the flipX and flipY to the current frame 
 | 
com.badlogic.gdx.graphics.Color | 
getColor()
Returns the  
Color tint applied to each frame | 
T | 
getCurrentFrame()
Returns the  
T of the current frame | 
int | 
getCurrentFrameIndex()
Returns the index of the current frame 
 | 
boolean | 
getFlipX()
Returns the flipX of the current frame 
 | 
boolean | 
getFlipY()
Returns the flipY 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 | 
getOriginX()
Returns the origin X coordinate to be applied to each frame 
 | 
float | 
getOriginY()
Returns the origin Y coordinate to be applied to each frame 
 | 
float | 
getRotation()
Returns the rotation of all frames 
 | 
boolean | 
isFinished()
Returns if this animation has finished
 
 If this is a looping animation, this method always returns false 
 | 
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 | 
setColor(com.badlogic.gdx.graphics.Color color)
Sets the  
Color tint applied to each frame | 
void | 
setColor(float r,
        float g,
        float b,
        float a)
Sets the  
Color tint applied to each frame | 
void | 
setFlipX(boolean flipX)
Sets the flipX to the current frame 
 | 
void | 
setFlipY(boolean flipY)
Sets the flipY to the current frame 
 | 
void | 
setLooping(boolean looping)
Sets if the animation should loop 
 | 
void | 
setOriginX(float originX)
Sets the origin X coordinate to be applied to each frame 
 | 
void | 
setOriginY(float originY)
Sets the origin Y coordinate to be applied to each frame 
 | 
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)
g - The Graphics context available for renderingpublic 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 degreespublic com.badlogic.gdx.graphics.Color getColor()
Color tint applied to each framepublic void setColor(com.badlogic.gdx.graphics.Color color)
Color tint applied to each framecolor - public void setColor(float r,
                     float g,
                     float b,
                     float a)
Color tint applied to each framer - The red value (0f - 1f)g - The green value (0f - 1f)b - The blue value (0f - 1f)a - The alpha value (0f - 1f)public float getOriginX()
public void setOriginX(float originX)
originX - public float getOriginY()
public void setOriginY(float originY)
originY - public void flip(boolean flipX,
                 boolean flipY)
flipX - flipY - public void setFlipX(boolean flipX)
flipX - public void setFlipY(boolean flipY)
flipY - public boolean getFlipX()
public boolean getFlipY()
public boolean isFinished()