private AnimationDesc obtain (final AnimationDesc anim) { return obtain(anim.animation, anim.offset, anim.duration, anim.loopCount, anim.speed, anim.listener); }
private AnimationDesc obtain (final AnimationDesc anim) { return obtain(anim.animation, anim.offset, anim.duration, anim.loopCount, anim.speed, anim.listener); }
/** Apply an action animation on top of the current animation. */ protected AnimationDesc action (final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationListener listener, float transitionTime) { return action(obtain(anim, offset, duration, loopCount, speed, listener), transitionTime); }
/** Changes the current animation by blending the new on top of the old during the transition time. */ protected AnimationDesc animate (final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationListener listener, float transitionTime) { return animate(obtain(anim, offset, duration, loopCount, speed, listener), transitionTime); }
/** Queue an animation to be applied when the current is finished. If current is continuous it will be synced on next loop. */ protected AnimationDesc queue (final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationListener listener, float transitionTime) { return queue(obtain(anim, offset, duration, loopCount, speed, listener), transitionTime); }
/** Changes the current animation by blending the new on top of the old during the transition time. */ protected AnimationDesc animate (final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationListener listener, float transitionTime) { return animate(obtain(anim, offset, duration, loopCount, speed, listener), transitionTime); }
/** Set the active animation, replacing any current animation. */ protected AnimationDesc setAnimation (final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationListener listener) { return setAnimation(obtain(anim, offset, duration, loopCount, speed, listener)); }
/** Queue an animation to be applied when the current is finished. If current is continuous it will be synced on next loop. */ protected AnimationDesc queue (final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationListener listener, float transitionTime) { return queue(obtain(anim, offset, duration, loopCount, speed, listener), transitionTime); }
/** Set the active animation, replacing any current animation. */ protected AnimationDesc setAnimation (final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationListener listener) { return setAnimation(obtain(anim, offset, duration, loopCount, speed, listener)); }
/** Apply an action animation on top of the current animation. */ protected AnimationDesc action (final Animation anim, float offset, float duration, int loopCount, float speed, final AnimationListener listener, float transitionTime) { return action(obtain(anim, offset, duration, loopCount, speed, listener), transitionTime); }
/** Apply an action animation on top of the current animation. * @param id The ID of the {@link Animation} within the {@link ModelInstance}. * @param offset The offset in seconds to the start of the animation. * @param duration The duration in seconds of the animation (or negative to play till the end of the animation). * @param loopCount The number of times to loop the animation, zero to play the animation only once, negative to continuously * loop the animation. * @param 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. * @param listener The {@link AnimationListener} which will be informed when the animation is looped or completed. * @param transitionTime The time to transition the new animation on top of the currently playing animation (if any). * @return The {@link AnimationDesc} which can be read to get the progress of the animation. Will be invalid when the animation * is completed. */ public AnimationDesc action (final String id, float offset, float duration, int loopCount, float speed, final AnimationListener listener, float transitionTime) { return action(obtain(id, offset, duration, loopCount, speed, listener), transitionTime); }
/** Set the active animation, replacing any current animation. * @param id The ID of the {@link Animation} within the {@link ModelInstance}. * @param offset The offset in seconds to the start of the animation. * @param duration The duration in seconds of the animation (or negative to play till the end of the animation). * @param loopCount The number of times to loop the animation, zero to play the animation only once, negative to continuously * loop the animation. * @param 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. * @param listener The {@link AnimationListener} which will be informed when the animation is looped or completed. * @return The {@link AnimationDesc} which can be read to get the progress of the animation. Will be invalid when the animation * is completed. */ public AnimationDesc setAnimation (final String id, float offset, float duration, int loopCount, float speed, final AnimationListener listener) { return setAnimation(obtain(id, offset, duration, loopCount, speed, listener)); }
/** Set the active animation, replacing any current animation. * @param id The ID of the {@link Animation} within the {@link ModelInstance}. * @param offset The offset in seconds to the start of the animation. * @param duration The duration in seconds of the animation (or negative to play till the end of the animation). * @param loopCount The number of times to loop the animation, zero to play the animation only once, negative to continuously * loop the animation. * @param 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. * @param listener The {@link AnimationListener} which will be informed when the animation is looped or completed. * @return The {@link AnimationDesc} which can be read to get the progress of the animation. Will be invalid when the animation * is completed. */ public AnimationDesc setAnimation (final String id, float offset, float duration, int loopCount, float speed, final AnimationListener listener) { return setAnimation(obtain(id, offset, duration, loopCount, speed, listener)); }
/** Apply an action animation on top of the current animation. * @param id The ID of the {@link Animation} within the {@link ModelInstance}. * @param offset The offset in seconds to the start of the animation. * @param duration The duration in seconds of the animation (or negative to play till the end of the animation). * @param loopCount The number of times to loop the animation, zero to play the animation only once, negative to continuously * loop the animation. * @param 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. * @param listener The {@link AnimationListener} which will be informed when the animation is looped or completed. * @param transitionTime The time to transition the new animation on top of the currently playing animation (if any). * @return The {@link AnimationDesc} which can be read to get the progress of the animation. Will be invalid when the animation * is completed. */ public AnimationDesc action (final String id, float offset, float duration, int loopCount, float speed, final AnimationListener listener, float transitionTime) { return action(obtain(id, offset, duration, loopCount, speed, listener), transitionTime); }
/** Changes the current animation by blending the new on top of the old during the transition time. * @param id The ID of the {@link Animation} within the {@link ModelInstance}. * @param offset The offset in seconds to the start of the animation. * @param duration The duration in seconds of the animation (or negative to play till the end of the animation). * @param loopCount The number of times to loop the animation, zero to play the animation only once, negative to continuously * loop the animation. * @param 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. * @param listener The {@link AnimationListener} which will be informed when the animation is looped or completed. * @param transitionTime The time to transition the new animation on top of the currently playing animation (if any). * @return The {@link AnimationDesc} which can be read to get the progress of the animation. Will be invalid when the animation * is completed. */ public AnimationDesc animate (final String id, float offset, float duration, int loopCount, float speed, final AnimationListener listener, float transitionTime) { return animate(obtain(id, offset, duration, loopCount, speed, listener), transitionTime); }
/** Changes the current animation by blending the new on top of the old during the transition time. * @param id The ID of the {@link Animation} within the {@link ModelInstance}. * @param offset The offset in seconds to the start of the animation. * @param duration The duration in seconds of the animation (or negative to play till the end of the animation). * @param loopCount The number of times to loop the animation, zero to play the animation only once, negative to continuously * loop the animation. * @param 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. * @param listener The {@link AnimationListener} which will be informed when the animation is looped or completed. * @param transitionTime The time to transition the new animation on top of the currently playing animation (if any). * @return The {@link AnimationDesc} which can be read to get the progress of the animation. Will be invalid when the animation * is completed. */ public AnimationDesc animate (final String id, float offset, float duration, int loopCount, float speed, final AnimationListener listener, float transitionTime) { return animate(obtain(id, offset, duration, loopCount, speed, listener), transitionTime); }
private AnimationDesc obtain (final String id, float offset, float duration, int loopCount, float speed, final AnimationListener listener) { if (id == null) return null; final Animation anim = target.getAnimation(id); if (anim == null) throw new GdxRuntimeException("Unknown animation: " + id); return obtain(anim, offset, duration, loopCount, speed, listener); }
private AnimationDesc obtain (final String id, float offset, float duration, int loopCount, float speed, final AnimationListener listener) { if (id == null) return null; final Animation anim = target.getAnimation(id); if (anim == null) throw new GdxRuntimeException("Unknown animation: " + id); return obtain(anim, offset, duration, loopCount, speed, listener); }
/** Apply an action animation on top of the current animation. */ protected AnimationDesc action (final AnimationDesc anim, float transitionTime) { if (anim.loopCount < 0) throw new GdxRuntimeException("An action cannot be continuous"); if (current == null || current.loopCount == 0) animate(anim, transitionTime); else { AnimationDesc toQueue = inAction ? null : obtain(current); inAction = false; animate(anim, transitionTime); inAction = true; if (toQueue != null) queue(toQueue, transitionTime); } return anim; } }
/** Apply an action animation on top of the current animation. */ protected AnimationDesc action (final AnimationDesc anim, float transitionTime) { if (anim.loopCount < 0) throw new GdxRuntimeException("An action cannot be continuous"); if (current == null || current.loopCount == 0) animate(anim, transitionTime); else { AnimationDesc toQueue = inAction ? null : obtain(current); inAction = false; animate(anim, transitionTime); inAction = true; if (toQueue != null) queue(toQueue, transitionTime); } return anim; } }