Animations on a ModelInstance. Use the
setAnimation(String, int, float, AnimationListener) method to change the current animation. Use the
animate(String, int, float, AnimationListener, float) method to start an animation, optionally blending onto the
current animation. Use the queue(String, int, float, AnimationListener, float) method to queue an animation to be
played when the current animation is finished. Use the action(String, int, float, AnimationListener, float) method to
play a (short) animation on top of the current animation.
You can use multiple AnimationControllers on the same ModelInstance, as long as they don't interfere with each other (don't
affect the same Nodes).
| Modifier and Type | Class and Description |
|---|---|
| public static class | AnimationController.
Class describing how to play and |
| public static interface | AnimationController.
Listener that will be informed when an animation is looped or completed. |
| Modifier and Type | Field and Description |
|---|---|
| public boolean | allowSameAnimation
Whether to allow the same animation to be played while playing that animation. |
| protected final Pool | |
| public AnimationController. | current
The animation currently playing. |
| public boolean | inAction
Whether an action is being performed. |
| private boolean | |
| public boolean | paused
When true a call to |
| public AnimationController. | previous
The animation which previously played. |
| public AnimationController. | |
| public float | queuedTransitionTime
The transition time which should be applied to the queued animation. |
| public float | transitionCurrentTime
The current transition time. |
| public float | transitionTargetTime
The target transition time. |
| Access | Constructor and Description |
|---|---|
| public | AnimationController(final ModelInstance
The target)ModelInstance on which the animations will be performed.Construct a new AnimationController. |
| Modifier and Type | Method and Description |
|---|---|
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, int Animation within the ModelInstance.The number of times to play the animation, 1 to play the animation only once, negative to continuously loop
the animation. loopCount, float The speed at which the animation should be played. Default is 1.0f. A value of 2.0f will play the animation at
twice the normal speed, a value of 0.5f will play the animation at half the normal speed, etc. This value can be
negative, causing the animation to played in reverse. This value cannot be zero. speed, final AnimationController.The listener,AnimationListener which will be informed when the animation is looped or completed.The time to transition the new animation on top of the currently playing animation (if any). transitionTime)Apply an action animation on top of the current animation. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, float Animation within the ModelInstance.The offset in seconds to the start of the animation. offset, float The duration in seconds of the animation (or negative to play till the end of the animation). duration, int The number of times to play the animation, 1 to play the animation only once, negative to continuously loop
the animation. loopCount, float The speed at which the animation should be played. Default is 1.0f. A value of 2.0f will play the animation at
twice the normal speed, a value of 0.5f will play the animation at half the normal speed, etc. This value can be
negative, causing the animation to played in reverse. This value cannot be zero. speed, final AnimationController.The listener,AnimationListener which will be informed when the animation is looped or completed.The time to transition the new animation on top of the currently playing animation (if any). transitionTime)Apply an action animation on top of the current animation. |
| protected AnimationController. | action(final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationController.
Apply an action animation on top of the current animation. |
| protected AnimationController. | action(final AnimationController.
Apply an action animation on top of the current animation. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, float Animation within the ModelInstance.The time to transition the new animation on top of the currently playing animation (if any). transitionTime)Changes the current animation by blending the new on top of the old during the transition time. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, final AnimationController.Animation within the ModelInstance.The listener,AnimationListener which will be informed when the animation is looped or completed.The time to transition the new animation on top of the currently playing animation (if any). transitionTime)Changes the current animation by blending the new on top of the old during the transition time. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, int Animation within the ModelInstance.The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation. loopCount, final AnimationController.The listener,AnimationListener which will be informed when the animation is looped or completed.The time to transition the new animation on top of the currently playing animation (if any). transitionTime)Changes the current animation by blending the new on top of the old during the transition time. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, int Animation within the ModelInstance.The number of times to play the animation, 1 to play the animation only once, negative to continuously loop
the animation. loopCount, float The speed at which the animation should be played. Default is 1.0f. A value of 2.0f will play the animation at
twice the normal speed, a value of 0.5f will play the animation at half the normal speed, etc. This value can be
negative, causing the animation to played in reverse. This value cannot be zero. speed, final AnimationController.The listener,AnimationListener which will be informed when the animation is looped or completed.The time to transition the new animation on top of the currently playing animation (if any). transitionTime)Changes the current animation by blending the new on top of the old during the transition time. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, float Animation within the ModelInstance.The offset in seconds to the start of the animation. offset, float The duration in seconds of the animation (or negative to play till the end of the animation). duration, int The number of times to play the animation, 1 to play the animation only once, negative to continuously loop
the animation. loopCount, float The speed at which the animation should be played. Default is 1.0f. A value of 2.0f will play the animation at
twice the normal speed, a value of 0.5f will play the animation at half the normal speed, etc. This value can be
negative, causing the animation to played in reverse. This value cannot be zero. speed, final AnimationController.The listener,AnimationListener which will be informed when the animation is looped or completed.The time to transition the new animation on top of the currently playing animation (if any). transitionTime)Changes the current animation by blending the new on top of the old during the transition time. |
| protected AnimationController. | animate(final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationController.
Changes the current animation by blending the new on top of the old during the transition time. |
| protected AnimationController. | animate(final AnimationController.
Changes the current animation by blending the new on top of the old during the transition time. |
| private AnimationController. | obtain(final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationController.
|
| private AnimationController. | obtain(final String id, float offset, float duration, int loopCount, float speed, final AnimationController.
|
| private AnimationController. | |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, int Animation within the ModelInstance.The number of times to play the animation, 1 to play the animation only once, negative to continuously loop
the animation. loopCount, float The speed at which the animation should be played. Default is 1.0f. A value of 2.0f will play the animation at
twice the normal speed, a value of 0.5f will play the animation at half the normal speed, etc. This value can be
negative, causing the animation to played in reverse. This value cannot be zero. speed, final AnimationController.The listener,AnimationListener which will be informed when the animation is looped or completed.The time to transition the new animation on top of the currently playing animation (if any). transitionTime)Queue an animation to be applied when the |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, float Animation within the ModelInstance.The offset in seconds to the start of the animation. offset, float The duration in seconds of the animation (or negative to play till the end of the animation). duration, int The number of times to play the animation, 1 to play the animation only once, negative to continuously loop
the animation. loopCount, float The speed at which the animation should be played. Default is 1.0f. A value of 2.0f will play the animation at
twice the normal speed, a value of 0.5f will play the animation at half the normal speed, etc. This value can be
negative, causing the animation to played in reverse. This value cannot be zero. speed, final AnimationController.The listener,AnimationListener which will be informed when the animation is looped or completed.The time to transition the new animation on top of the currently playing animation (if any). transitionTime)Queue an animation to be applied when the |
| protected AnimationController. | queue(final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationController.
Queue an animation to be applied when the current is finished. |
| protected AnimationController. | queue(final AnimationController.
Queue an animation to be applied when the current is finished. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id)Animation within the ModelInstance.Set the active animation, replacing any current animation. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, int Animation within the ModelInstance.The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation. loopCount)Set the active animation, replacing any current animation. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, final AnimationController.Animation within the ModelInstance.The listenerAnimationListener which will be informed when the animation is looped or completed.Set the active animation, replacing any current animation. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, int Animation within the ModelInstance.The number of times to play the animation, 1 to play the animation only once, negative to continuously loop
the animation. loopCount, final AnimationController.The listenerAnimationListener which will be informed when the animation is looped or completed.Set the active animation, replacing any current animation. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, int Animation within the ModelInstance.The number of times to play the animation, 1 to play the animation only once, negative to continuously loop
the animation. loopCount, float The speed at which the animation should be played. Default is 1.0f. A value of 2.0f will play the animation at
twice the normal speed, a value of 0.5f will play the animation at half the normal speed, etc. This value can be
negative, causing the animation to played in reverse. This value cannot be zero. speed, final AnimationController.The listenerAnimationListener which will be informed when the animation is looped or completed.Set the active animation, replacing any current animation. |
| public AnimationController. | Returns: TheAnimationDesc which can be read to get the progress of the animation. Will be invalid when the animation
is completed.The ID of the id, float Animation within the ModelInstance.The offset in seconds to the start of the animation. offset, float The duration in seconds of the animation (or negative to play till the end of the animation). duration, int The number of times to play the animation, 1 to play the animation only once, negative to continuously loop
the animation. loopCount, float The speed at which the animation should be played. Default is 1.0f. A value of 2.0f will play the animation at
twice the normal speed, a value of 0.5f will play the animation at half the normal speed, etc. This value can be
negative, causing the animation to played in reverse. This value cannot be zero. speed, final AnimationController.The listenerAnimationListener which will be informed when the animation is looped or completed.Set the active animation, replacing any current animation. |
| protected AnimationController. | setAnimation(final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationController.
Set the active animation, replacing any current animation. |
| protected AnimationController. | setAnimation(final AnimationController.
Set the active animation, replacing any current animation. |
| public void | update(float
The time elapsed since last update, change this to alter the overall speed (can be negative). delta)Update any animations currently being played. |