public interface Animator
Animation
.
To play correctly an animation, it just needs the following steps:
play(Animation)
updateAnimation(double)
in your main loopExample:
final Animator animator = Anim.createAnimator(); final Animation animation = Anim.createAnimation(4, 6, 0.125, false, true); animator.play(animation); // ... (loop) animator.updateAnimation(extrp); // (loop) ...
Modifier and Type | Method and Description |
---|---|
AnimState |
getAnimState()
Get current animation state.
|
int |
getFrame()
Get the playing frame number.
|
int |
getFrameAnim()
Get the current playing animation frame number (value between first and last of the current animation).
|
void |
play(Animation animation)
Play the animation.
|
void |
setAnimSpeed(double speed)
Set the current animation speed.
|
void |
setFrame(int frame)
Set a fixed frame (it will overwrite the current animation frame).
|
void |
stopAnimation()
Stop the current animation (animation state set to
AnimState.STOPPED ). |
void |
updateAnimation(double extrp)
Animation update routine.
|
void play(Animation animation)
updateAnimation(double)
does the animation
update.animation
- The animation to play.void stopAnimation()
AnimState.STOPPED
).void updateAnimation(double extrp)
play(Animation)
.extrp
- The extrapolation value.void setAnimSpeed(double speed)
Can be used to synchronize the player movement speed to the walking animation speed.
speed
- The new animation speed.void setFrame(int frame)
frame
- The frame to set.AnimState getAnimState()
int getFrame()
int getFrameAnim()