Package com.nevergarden.myna.display
Class TPSpriteAnimation
- java.lang.Object
-
- com.nevergarden.myna.events.EventDispatcher
-
- com.nevergarden.myna.display.DisplayObject
-
- com.nevergarden.myna.display.Quad
-
- com.nevergarden.myna.display.TPSpriteAnimation
-
- All Implemented Interfaces:
Animatable
,Drawable
public class TPSpriteAnimation extends Quad implements Animatable
TexturePacker Sprite Animation Item.
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.Integer
currentFrame
java.lang.Integer
frameRate
-
Fields inherited from class com.nevergarden.myna.display.Quad
color, height, modelMatrix, width
-
Fields inherited from class com.nevergarden.myna.display.DisplayObject
parent, pivot, position, rotation, scale, transform
-
Fields inherited from class com.nevergarden.myna.events.EventDispatcher
eventListeners
-
-
Constructor Summary
Constructors Constructor Description TPSpriteAnimation(TPAtlas atlas, Color color, int width, int height)
Constructor with 24 frame per secondTPSpriteAnimation(TPAtlas atlas, Color color, int width, int height, int frameRate)
Default Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
draw(int frame)
Draws the drawable on the given frame.java.lang.Integer
getFrameCount()
Total animation frames.java.lang.Integer
getFrameRate()
Get frame count updated per second.java.lang.Boolean
isLoop()
Checks if animation is loop.void
play()
Plays the animation.void
setFrameRate(java.lang.Integer frameRate)
Sets frame counts updated per second.void
setLooping(java.lang.Boolean isLoop)
Set looping value.void
stop()
Stops the animation.-
Methods inherited from class com.nevergarden.myna.display.Quad
recalculateMatrix
-
Methods inherited from class com.nevergarden.myna.display.DisplayObject
getPosition, removeFromParent, rotate, setLocalX, setLocalY, setParent, setPivot, setPivotX, setPivotY, setPosition, setRotation, setScale, setScaleX, setScaleY
-
Methods inherited from class com.nevergarden.myna.events.EventDispatcher
addEventListener, dispatchEvent, dispatchEventWith, dispatchEventWith, dispose, hasEventListener, invokeEvent, removeEventListener, removeEventListeners
-
-
-
-
Method Detail
-
draw
public void draw(int frame)
Description copied from interface:Drawable
Draws the drawable on the given frame.
-
play
public void play()
Description copied from interface:Animatable
Plays the animation.- Specified by:
play
in interfaceAnimatable
-
stop
public void stop()
Description copied from interface:Animatable
Stops the animation.- Specified by:
stop
in interfaceAnimatable
-
isLoop
public java.lang.Boolean isLoop()
Description copied from interface:Animatable
Checks if animation is loop.- Specified by:
isLoop
in interfaceAnimatable
-
setLooping
public void setLooping(java.lang.Boolean isLoop)
Description copied from interface:Animatable
Set looping value.- Specified by:
setLooping
in interfaceAnimatable
-
getFrameRate
public java.lang.Integer getFrameRate()
Description copied from interface:Animatable
Get frame count updated per second.- Specified by:
getFrameRate
in interfaceAnimatable
-
setFrameRate
public void setFrameRate(java.lang.Integer frameRate)
Description copied from interface:Animatable
Sets frame counts updated per second.- Specified by:
setFrameRate
in interfaceAnimatable
-
getFrameCount
public java.lang.Integer getFrameCount()
Description copied from interface:Animatable
Total animation frames.- Specified by:
getFrameCount
in interfaceAnimatable
-
-