Class IntAnimationController
java.lang.Object
gaiasky.util.gdx.model.BaseIntAnimationController
gaiasky.util.gdx.model.IntAnimationController
- Direct Known Subclasses:
AnimationControllerHack
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass describing how to play andAnimation.static interfaceListener that will be informed when an animation is looped or completed.Nested classes/interfaces inherited from class BaseIntAnimationController
BaseIntAnimationController.Transform -
Field Summary
FieldsModifier and TypeFieldDescriptionbooleanWhether to allow the same animation to be played while playing that animation.protected final com.badlogic.gdx.utils.Pool<IntAnimationController.AnimationDesc> The animation currently playing.booleanWhether an action is being performed.booleanWhen true a call toupdate(float)will not be processed.The animation which previously played.The animation queued to be played when thecurrentanimation is completed.floatThe transition time which should be applied to the queued animation.floatThe current transition time.floatThe target transition time.Fields inherited from class BaseIntAnimationController
targetModifier and TypeFieldDescriptionfinal IntModelInstanceTheIntModelInstanceon which the animations are being performed. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new AnimationController. -
Method Summary
Modifier and TypeMethodDescriptionprotected IntAnimationController.AnimationDescaction(IntAnimationController.AnimationDesc anim, float transitionTime) Apply an action animation on top of the current animation.protected IntAnimationController.AnimationDescaction(IntAnimation anim, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Apply an action animation on top of the current animation.action(String id, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Apply an action animation on top of the current animation.action(String id, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Apply an action animation on top of the current animation.protected IntAnimationController.AnimationDescanimate(IntAnimationController.AnimationDesc anim, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time.protected IntAnimationController.AnimationDescanimate(IntAnimation anim, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time.Changes the current animation by blending the new on top of the old during the transition time.animate(String id, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time.animate(String id, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time.animate(String id, int loopCount, IntAnimationController.AnimationListener listener, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time.animate(String id, IntAnimationController.AnimationListener listener, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time.protected IntAnimationController.AnimationDescqueue(IntAnimationController.AnimationDesc anim, float transitionTime) Queue an animation to be applied when the current is finished.protected IntAnimationController.AnimationDescqueue(IntAnimation anim, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Queue an animation to be applied when the current is finished.queue(String id, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Queue an animation to be applied when thecurrentanimation is finished.queue(String id, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Queue an animation to be applied when thecurrentanimation is finished.protected IntAnimationController.AnimationDescSet the active animation, replacing any current animation.protected IntAnimationController.AnimationDescsetAnimation(IntAnimation anim, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener) Set the active animation, replacing any current animation.setAnimation(String id) Set the active animation, replacing any current animation.setAnimation(String id, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener) Set the active animation, replacing any current animation.setAnimation(String id, int loopCount) Set the active animation, replacing any current animation.setAnimation(String id, int loopCount, float speed, IntAnimationController.AnimationListener listener) Set the active animation, replacing any current animation.setAnimation(String id, int loopCount, IntAnimationController.AnimationListener listener) Set the active animation, replacing any current animation.setAnimation(String id, IntAnimationController.AnimationListener listener) Set the active animation, replacing any current animation.voidupdate(float delta) Update any animations currently being played.Methods inherited from class BaseIntAnimationController
apply, applyAnimation, applyAnimation, applyAnimations, begin, end, removeAnimationModifier and TypeMethodDescriptionprotected voidapply(IntAnimation animation, float time, float weight) Apply an animation, must be called between {BaseIntAnimationController.begin()and {BaseIntAnimationController.end().protected static voidapplyAnimation(com.badlogic.gdx.utils.ObjectMap<IntNode, BaseIntAnimationController.Transform> out, com.badlogic.gdx.utils.Pool<BaseIntAnimationController.Transform> pool, float alpha, IntAnimation animation, float time) Helper method to apply one animation to either an objectmap for blending or directly to the bones.protected voidapplyAnimation(IntAnimation animation, float time) Apply a single animation to theIntModelInstanceand update the it to reflect the changes.protected voidapplyAnimations(IntAnimation anim1, float time1, IntAnimation anim2, float time2, float weight) Apply two animations, blending the second onto to first using weight.protected voidbegin()Begin applying multiple animations to the instance, must followed by one or more calls to {BaseIntAnimationController.apply(IntAnimation, float, float)and finally {BaseIntAnimationController.end().protected voidend()End applying multiple animations to the instance and update it to reflect the changes.protected voidremoveAnimation(IntAnimation animation) Remove the specified animation, by marking the affected nodes as not animated.
-
Field Details
-
animationPool
-
current
The animation currently playing. Do not alter this value. -
queued
The animation queued to be played when thecurrentanimation is completed. Do not alter this value. -
queuedTransitionTime
public float queuedTransitionTimeThe transition time which should be applied to the queued animation. Do not alter this value. -
previous
The animation which previously played. Do not alter this value. -
transitionCurrentTime
public float transitionCurrentTimeThe current transition time. Do not alter this value. -
transitionTargetTime
public float transitionTargetTimeThe target transition time. Do not alter this value. -
inAction
public boolean inActionWhether an action is being performed. Do not alter this value. -
paused
public boolean pausedWhen true a call toupdate(float)will not be processed. -
allowSameAnimation
public boolean allowSameAnimationWhether to allow the same animation to be played while playing that animation.
-
-
Constructor Details
-
IntAnimationController
Construct a new AnimationController.- Parameters:
target- TheIntModelInstanceon which the animations will be performed.
-
-
Method Details
-
update
public void update(float delta) Update any animations currently being played.- Parameters:
delta- The time elapsed since last update, change this to alter the overall speed (can be negative).
-
setAnimation
Set the active animation, replacing any current animation.- Parameters:
id- The ID of theAnimationwithin theModelInstance.- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
setAnimation
Set the active animation, replacing any current animation.- Parameters:
id- The ID of theAnimationwithin theModelInstance.loopCount- The number of times to loop the animation, zero to play the animation only once, negative to continuously loop the animation.- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
setAnimation
public IntAnimationController.AnimationDesc setAnimation(String id, IntAnimationController.AnimationListener listener) Set the active animation, replacing any current animation.- Parameters:
id- The ID of theAnimationwithin theModelInstance.listener- TheIntAnimationController.AnimationListenerwhich will be informed when the animation is looped or completed.- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
setAnimation
public IntAnimationController.AnimationDesc setAnimation(String id, int loopCount, IntAnimationController.AnimationListener listener) Set the active animation, replacing any current animation.- Parameters:
id- The ID of theAnimationwithin theModelInstance.loopCount- The number of times to play the animation, 1 to play the animation only once, negative to continuously loop the animation.listener- TheIntAnimationController.AnimationListenerwhich will be informed when the animation is looped or completed.- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
setAnimation
public IntAnimationController.AnimationDesc setAnimation(String id, int loopCount, float speed, IntAnimationController.AnimationListener listener) Set the active animation, replacing any current animation.- Parameters:
id- The ID of theAnimationwithin theModelInstance.loopCount- The number of times to play the animation, 1 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- TheIntAnimationController.AnimationListenerwhich will be informed when the animation is looped or completed.- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
setAnimation
public IntAnimationController.AnimationDesc setAnimation(String id, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener) Set the active animation, replacing any current animation.- Parameters:
id- The ID of theAnimationwithin theModelInstance.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 play the animation, 1 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- TheIntAnimationController.AnimationListenerwhich will be informed when the animation is looped or completed.- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
setAnimation
protected IntAnimationController.AnimationDesc setAnimation(IntAnimation anim, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener) Set the active animation, replacing any current animation. -
setAnimation
protected IntAnimationController.AnimationDesc setAnimation(IntAnimationController.AnimationDesc anim) Set the active animation, replacing any current animation. -
animate
Changes the current animation by blending the new on top of the old during the transition time.- Parameters:
id- The ID of theAnimationwithin theModelInstance.transitionTime- The time to transition the new animation on top of the currently playing animation (if any).- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
animate
public IntAnimationController.AnimationDesc animate(String id, IntAnimationController.AnimationListener listener, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time.- Parameters:
id- The ID of theAnimationwithin theModelInstance.listener- TheIntAnimationController.AnimationListenerwhich 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).- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
animate
public IntAnimationController.AnimationDesc animate(String id, int loopCount, IntAnimationController.AnimationListener listener, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time.- Parameters:
id- The ID of theAnimationwithin theModelInstance.loopCount- The number of times to loop the animation, zero to play the animation only once, negative to continuously loop the animation.listener- TheIntAnimationController.AnimationListenerwhich 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).- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
animate
public IntAnimationController.AnimationDesc animate(String id, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time.- Parameters:
id- The ID of theAnimationwithin theModelInstance.loopCount- The number of times to play the animation, 1 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- TheIntAnimationController.AnimationListenerwhich 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).- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
animate
public IntAnimationController.AnimationDesc animate(String id, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time.- Parameters:
id- The ID of theAnimationwithin theModelInstance.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 play the animation, 1 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- TheIntAnimationController.AnimationListenerwhich 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).- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
animate
protected IntAnimationController.AnimationDesc animate(IntAnimation anim, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time. -
animate
protected IntAnimationController.AnimationDesc animate(IntAnimationController.AnimationDesc anim, float transitionTime) Changes the current animation by blending the new on top of the old during the transition time. -
queue
public IntAnimationController.AnimationDesc queue(String id, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Queue an animation to be applied when thecurrentanimation is finished. If the current animation is continuously looping it will be synchronized on next loop.- Parameters:
id- The ID of theAnimationwithin theModelInstance.loopCount- The number of times to play the animation, 1 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- TheIntAnimationController.AnimationListenerwhich 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).- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
queue
public IntAnimationController.AnimationDesc queue(String id, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Queue an animation to be applied when thecurrentanimation is finished. If the current animation is continuously looping it will be synchronized on next loop.- Parameters:
id- The ID of theAnimationwithin theModelInstance.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 play the animation, 1 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- TheIntAnimationController.AnimationListenerwhich 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).- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
queue
protected IntAnimationController.AnimationDesc queue(IntAnimation anim, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Queue an animation to be applied when the current is finished. If current is continuous it will be synced on next loop. -
queue
protected IntAnimationController.AnimationDesc queue(IntAnimationController.AnimationDesc anim, float transitionTime) Queue an animation to be applied when the current is finished. If current is continuous it will be synced on next loop. -
action
public IntAnimationController.AnimationDesc action(String id, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Apply an action animation on top of the current animation.- Parameters:
id- The ID of theAnimationwithin theModelInstance.loopCount- The number of times to play the animation, 1 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- TheIntAnimationController.AnimationListenerwhich 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).- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
action
public IntAnimationController.AnimationDesc action(String id, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Apply an action animation on top of the current animation.- Parameters:
id- The ID of theAnimationwithin theModelInstance.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 play the animation, 1 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- TheIntAnimationController.AnimationListenerwhich 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).- Returns:
- The
IntAnimationController.AnimationDescwhich can be read to get the progress of the animation. Will be invalid when the animation is completed.
-
action
protected IntAnimationController.AnimationDesc action(IntAnimation anim, float offset, float duration, int loopCount, float speed, IntAnimationController.AnimationListener listener, float transitionTime) Apply an action animation on top of the current animation. -
action
protected IntAnimationController.AnimationDesc action(IntAnimationController.AnimationDesc anim, float transitionTime) Apply an action animation on top of the current animation.
-