public class AnimationController extends BaseAnimationController
Animation
s 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 Node
s).Modifier and Type | Class and Description |
---|---|
static class |
AnimationController.AnimationDesc
Class describing how to play and
Animation . |
static interface |
AnimationController.AnimationListener
Listener that will be informed when an animation is looped or completed.
|
BaseAnimationController.Transform
Modifier and Type | Field and Description |
---|---|
boolean |
allowSameAnimation
Whether to allow the same animation to be played while playing that animation.
|
AnimationController.AnimationDesc |
current
The animation currently playing.
|
boolean |
inAction
Whether an action is being performed.
|
boolean |
paused
When true a call to
update(float) will not be processed. |
AnimationController.AnimationDesc |
previous
The animation which previously played.
|
AnimationController.AnimationDesc |
queued
The animation queued to be played when the
current animation is completed. |
float |
queuedTransitionTime
The transition time which should be applied to the queued animation.
|
float |
transitionCurrentTime
The current transition time.
|
float |
transitionTargetTime
The target transition time.
|
target
Constructor and Description |
---|
AnimationController(ModelInstance target)
Construct a new AnimationController.
|
Modifier and Type | Method and Description |
---|---|
AnimationController.AnimationDesc |
action(String id,
float offset,
float duration,
int loopCount,
float speed,
AnimationController.AnimationListener listener,
float transitionTime)
Apply an action animation on top of the current animation.
|
AnimationController.AnimationDesc |
action(String id,
int loopCount,
float speed,
AnimationController.AnimationListener listener,
float transitionTime)
Apply an action animation on top of the current animation.
|
AnimationController.AnimationDesc |
animate(String id,
AnimationController.AnimationListener listener,
float transitionTime)
Changes the current animation by blending the new on top of the old during the transition time.
|
AnimationController.AnimationDesc |
animate(String id,
float transitionTime)
Changes the current animation by blending the new on top of the old during the transition time.
|
AnimationController.AnimationDesc |
animate(String id,
float offset,
float duration,
int loopCount,
float speed,
AnimationController.AnimationListener listener,
float transitionTime)
Changes the current animation by blending the new on top of the old during the transition time.
|
AnimationController.AnimationDesc |
animate(String id,
int loopCount,
AnimationController.AnimationListener listener,
float transitionTime)
Changes the current animation by blending the new on top of the old during the transition time.
|
AnimationController.AnimationDesc |
animate(String id,
int loopCount,
float speed,
AnimationController.AnimationListener listener,
float transitionTime)
Changes the current animation by blending the new on top of the old during the transition time.
|
AnimationController.AnimationDesc |
queue(String id,
float offset,
float duration,
int loopCount,
float speed,
AnimationController.AnimationListener listener,
float transitionTime)
Queue an animation to be applied when the
current animation is finished. |
AnimationController.AnimationDesc |
queue(String id,
int loopCount,
float speed,
AnimationController.AnimationListener listener,
float transitionTime)
Queue an animation to be applied when the
current animation is finished. |
AnimationController.AnimationDesc |
setAnimation(String id)
Set the active animation, replacing any current animation.
|
AnimationController.AnimationDesc |
setAnimation(String id,
AnimationController.AnimationListener listener)
Set the active animation, replacing any current animation.
|
AnimationController.AnimationDesc |
setAnimation(String id,
float offset,
float duration,
int loopCount,
float speed,
AnimationController.AnimationListener listener)
Set the active animation, replacing any current animation.
|
AnimationController.AnimationDesc |
setAnimation(String id,
int loopCount)
Set the active animation, replacing any current animation.
|
AnimationController.AnimationDesc |
setAnimation(String id,
int loopCount,
AnimationController.AnimationListener listener)
Set the active animation, replacing any current animation.
|
AnimationController.AnimationDesc |
setAnimation(String id,
int loopCount,
float speed,
AnimationController.AnimationListener listener)
Set the active animation, replacing any current animation.
|
void |
update(float delta)
Update any animations currently being played.
|
public AnimationController.AnimationDesc current
public AnimationController.AnimationDesc queued
current
animation is completed. Do not alter this value.public float queuedTransitionTime
public AnimationController.AnimationDesc previous
public float transitionCurrentTime
public float transitionTargetTime
public boolean inAction
public boolean paused
update(float)
will not be processed.public boolean allowSameAnimation
public AnimationController(ModelInstance target)
target
- The ModelInstance
on which the animations will be performed.public void update(float delta)
delta
- The time elapsed since last update, change this to alter the overall speed (can be negative).public AnimationController.AnimationDesc setAnimation(String id)
id
- The ID of the Animation
within the ModelInstance
.AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc setAnimation(String id, int loopCount)
id
- The ID of the Animation
within the ModelInstance
.loopCount
- The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation.AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc setAnimation(String id, AnimationController.AnimationListener listener)
id
- The ID of the Animation
within the ModelInstance
.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc setAnimation(String id, int loopCount, AnimationController.AnimationListener listener)
id
- The ID of the Animation
within the ModelInstance
.loopCount
- The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc setAnimation(String id, int loopCount, float speed, AnimationController.AnimationListener listener)
id
- The ID of the Animation
within the ModelInstance
.loopCount
- The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation.speed
- 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.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc setAnimation(String id, float offset, float duration, int loopCount, float speed, AnimationController.AnimationListener listener)
id
- The ID of the Animation
within the ModelInstance
.offset
- The offset in seconds to the start of the animation.duration
- The duration in seconds of the animation (or negative to play till the end of the animation).loopCount
- The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation.speed
- 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.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc animate(String id, float transitionTime)
id
- The ID of the Animation
within the ModelInstance
.transitionTime
- The time to transition the new animation on top of the currently playing animation (if any).AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc animate(String id, AnimationController.AnimationListener listener, float transitionTime)
id
- The ID of the Animation
within the ModelInstance
.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.transitionTime
- The time to transition the new animation on top of the currently playing animation (if any).AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc animate(String id, int loopCount, AnimationController.AnimationListener listener, float transitionTime)
id
- The ID of the Animation
within the ModelInstance
.loopCount
- The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.transitionTime
- The time to transition the new animation on top of the currently playing animation (if any).AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc animate(String id, int loopCount, float speed, AnimationController.AnimationListener listener, float transitionTime)
id
- The ID of the Animation
within the ModelInstance
.loopCount
- The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation.speed
- 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.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.transitionTime
- The time to transition the new animation on top of the currently playing animation (if any).AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc animate(String id, float offset, float duration, int loopCount, float speed, AnimationController.AnimationListener listener, float transitionTime)
id
- The ID of the Animation
within the ModelInstance
.offset
- The offset in seconds to the start of the animation.duration
- The duration in seconds of the animation (or negative to play till the end of the animation).loopCount
- The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation.speed
- 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.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.transitionTime
- The time to transition the new animation on top of the currently playing animation (if any).AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc queue(String id, int loopCount, float speed, AnimationController.AnimationListener listener, float transitionTime)
current
animation is finished. If the current animation is continuously
looping it will be synchronized on next loop.id
- The ID of the Animation
within the ModelInstance
.loopCount
- The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation.speed
- 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.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.transitionTime
- The time to transition the new animation on top of the currently playing animation (if any).AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc queue(String id, float offset, float duration, int loopCount, float speed, AnimationController.AnimationListener listener, float transitionTime)
current
animation is finished. If the current animation is continuously
looping it will be synchronized on next loop.id
- The ID of the Animation
within the ModelInstance
.offset
- The offset in seconds to the start of the animation.duration
- The duration in seconds of the animation (or negative to play till the end of the animation).loopCount
- The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation.speed
- 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.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.transitionTime
- The time to transition the new animation on top of the currently playing animation (if any).AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc action(String id, int loopCount, float speed, AnimationController.AnimationListener listener, float transitionTime)
id
- The ID of the Animation
within the ModelInstance
.loopCount
- The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation.speed
- 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.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.transitionTime
- The time to transition the new animation on top of the currently playing animation (if any).AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.public AnimationController.AnimationDesc action(String id, float offset, float duration, int loopCount, float speed, AnimationController.AnimationListener listener, float transitionTime)
id
- The ID of the Animation
within the ModelInstance
.offset
- The offset in seconds to the start of the animation.duration
- The duration in seconds of the animation (or negative to play till the end of the animation).loopCount
- The number of times to loop the animation, zero to play the animation only once, negative to continuously
loop the animation.speed
- 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.listener
- The AnimationController.AnimationListener
which will be informed when the animation is looped or completed.transitionTime
- The time to transition the new animation on top of the currently playing animation (if any).AnimationController.AnimationDesc
which can be read to get the progress of the animation. Will be invalid when the animation
is completed.Copyright © 2015. All rights reserved.