com.annahid.libs.artenus.graphics.animation
ImageAnimation
Performs an animation based on the frames contained in an image sprite's cutout. Note that this
class targets only image sprites. You must only assign this animation to an instance of
ImageSprite
.See Also:
public final class ImageAnimation implements AnimationHandler
Constructor Summary
Modifier and Type | Constructor and Description |
---|---|
public | ImageAnimation(int[] animationFrames) Creates an ImageAnimation with the given set of frames and a loop trend. |
public | ImageAnimation(int[] animationFrames, Trends trend) Creates an ImageAnimation with the given set of frames and trend. |
public | ImageAnimation(int[] animationFrames, Trends trend, int startIndex) Creates an ImageAnimation with the given set of frames and trend. |
Method Summary
Modifier and Type | Method and Description |
---|---|
public void | advance(Animatable sprite, float elapsedTime) Called whenever the animation should update the image sprite based on elapsed time. |
public int | getFrame() Gets the current frame index of the animation. |
public Trends | getTrend() Gets the trend of this image animation. |
public void | setFrameDelay(int delay) Adjusts frame interval for the animation. |
public void | setFrameDelay(float delay) Adjusts frame interval for the animation. |
Methods inherited from java.lang.Object
clone
, equals
, finalize
, getClass
, hashCode
, notify
, notifyAll
, toString
, wait
, wait
, wait
Constructor Detail
ImageAnimation | ||
---|---|---|
public ImageAnimation( int[] animationFrames )Creates an ImageAnimation with the given set of frames and a loop trend. Parameters:
See Also:
|
ImageAnimation | ||||
---|---|---|---|---|
public ImageAnimation( int[] animationFrames, Trends trend )Creates an ImageAnimation with the given set of frames and trend. Parameters:
See Also:
|
ImageAnimation | ||||||
---|---|---|---|---|---|---|
public ImageAnimation( int[] animationFrames, Trends trend, int startIndex )Creates an ImageAnimation with the given set of frames and trend. The animation is started at a given frame index. Parameters:
See Also:
|
Method Detail
advance |
---|
public void advance( Animatable sprite, float elapsedTime ) Called whenever the animation should update the image sprite based on elapsed time.
Frame timing is automatically handled based on your adjustment using
setFrameDelay(int) .Specified By:
See Also:
|
getFrame |
---|
public int getFrame() Gets the current frame index of the animation. Returns:
The current frame of the animation. This value indicates the index in the frame
array, and not the frame index belonging to the sprite's cutout. See Also:
|
getTrend |
---|
public Trends getTrend() Returns:
The animation trend See Also:
|
setFrameDelay | ||
---|---|---|
public void setFrameDelay( int delay ) Adjusts frame interval for the animation. This is a legacy method which is still supported.
It is recommended to use setFrameDelay(float) instead as it is guaranteed not to
be deprecated in future versions.Parameters:
See Also:
|
setFrameDelay | ||
---|---|---|
public void setFrameDelay( float delay ) Adjusts frame interval for the animation. The difference between this method and
setFrameDelay(int) is that this method gets the delay in seconds and in floating
point format, which is compatible with the rest of the framework.Parameters:
See Also:
|