public interface Animator extends Updatable
Animation
.
To play correctly an animation, it just needs the following steps:
play(Animation)
Updatable.update(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.update(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 |
stop()
Stop the current animation (animation state set to
AnimState.STOPPED ). |
void play(Animation animation)
Updatable.update(double)
does the animation update.animation
- The animation to play (must not be null
).LionEngineException
- If the animation is null
.void stop()
AnimState.STOPPED
).void setAnimSpeed(double speed)
Can be used to synchronize the player movement speed to the walking animation speed.
speed
- The new animation speed (positive).LionEngineException
- If speed is negative.void setFrame(int frame)
frame
- The frame to set (superior or equal to Animation.MINIMUM_FRAME
).LionEngineException
- If frame is out of range.int getFrame()
int getFrameAnim()
AnimState getAnimState()
Copyright © 2016 Byron 3D Games Studio. All rights reserved.