/** Set the active animation, replacing any current animation. */ protected AnimationDesc setAnimation (final AnimationDesc anim) { if (current == null) current = anim; else { if (!allowSameAnimation && anim != null && current.animation == anim.animation) anim.time = current.time; else removeAnimation(current.animation); animationPool.free(current); current = anim; } justChangedAnimation = true; return anim; }
/** Set the active animation, replacing any current animation. */ protected AnimationDesc setAnimation (final AnimationDesc anim) { if (current == null) current = anim; else { if (!allowSameAnimation && anim != null && current.animation == anim.animation) anim.time = current.time; else removeAnimation(current.animation); animationPool.free(current); current = anim; } justChangedAnimation = true; return anim; }
/** Changes the current animation by blending the new on top of the old during the transition time. */ protected AnimationDesc animate (final AnimationDesc anim, float transitionTime) { if (current == null) current = anim; else if (inAction) queue(anim, transitionTime); else if (!allowSameAnimation && anim != null && current.animation == anim.animation) { anim.time = current.time; animationPool.free(current); current = anim; } else { if (previous != null) { removeAnimation(previous.animation); animationPool.free(previous); } previous = current; current = anim; transitionCurrentTime = 0f; transitionTargetTime = transitionTime; } return anim; }
/** Changes the current animation by blending the new on top of the old during the transition time. */ protected AnimationDesc animate (final AnimationDesc anim, float transitionTime) { if (current == null) current = anim; else if (inAction) queue(anim, transitionTime); else if (!allowSameAnimation && anim != null && current.animation == anim.animation) { anim.time = current.time; animationPool.free(current); current = anim; } else { if (previous != null) { removeAnimation(previous.animation); animationPool.free(previous); } previous = current; current = anim; transitionCurrentTime = 0f; transitionTargetTime = transitionTime; } return anim; }
/** Update any animations currently being played. * @param delta The time elapsed since last update, change this to alter the overall speed (can be negative). */ public void update (float delta) { if (paused) return; if (previous != null && ((transitionCurrentTime += delta) >= transitionTargetTime)) { removeAnimation(previous.animation); justChangedAnimation = true; animationPool.free(previous); previous = null; } if (justChangedAnimation) { target.calculateTransforms(); justChangedAnimation = false; } if (current == null || current.loopCount == 0 || current.animation == null) return; final float remain = current.update(delta); if (remain != 0f && queued != null) { inAction = false; animate(queued, queuedTransitionTime); queued = null; update(remain); return; } if (previous != null) applyAnimations(previous.animation, previous.offset + previous.time, current.animation, current.offset + current.time, transitionCurrentTime / transitionTargetTime); else applyAnimation(current.animation, current.offset + current.time); }
/** Update any animations currently being played. * @param delta The time elapsed since last update, change this to alter the overall speed (can be negative). */ public void update (float delta) { if (paused) return; if (previous != null && ((transitionCurrentTime += delta) >= transitionTargetTime)) { removeAnimation(previous.animation); justChangedAnimation = true; animationPool.free(previous); previous = null; } if (justChangedAnimation) { target.calculateTransforms(); justChangedAnimation = false; } if (current == null || current.loopCount == 0 || current.animation == null) return; final float remain = current.update(delta); if (remain != 0f && queued != null) { inAction = false; animate(queued, queuedTransitionTime); queued = null; update(remain); return; } if (previous != null) applyAnimations(previous.animation, previous.offset + previous.time, current.animation, current.offset + current.time, transitionCurrentTime / transitionTargetTime); else applyAnimation(current.animation, current.offset + current.time); }
/** Set the active animation, replacing any current animation. */ protected AnimationDesc setAnimation (final AnimationDesc anim) { if (current == null) current = anim; else { if (!allowSameAnimation && anim != null && current.animation == anim.animation) anim.time = current.time; else removeAnimation(current.animation); animationPool.free(current); current = anim; } justChangedAnimation = true; return anim; }
/** Changes the current animation by blending the new on top of the old during the transition time. */ protected AnimationDesc animate (final AnimationDesc anim, float transitionTime) { if (current == null) current = anim; else if (inAction) queue(anim, transitionTime); else if (!allowSameAnimation && anim != null && current.animation == anim.animation) { anim.time = current.time; animationPool.free(current); current = anim; } else { if (previous != null) { removeAnimation(previous.animation); animationPool.free(previous); } previous = current; current = anim; transitionCurrentTime = 0f; transitionTargetTime = transitionTime; } return anim; }
/** Update any animations currently being played. * @param delta The time elapsed since last update, change this to alter the overall speed (can be negative). */ public void update (float delta) { if (paused) return; if (previous != null && ((transitionCurrentTime += delta) >= transitionTargetTime)) { removeAnimation(previous.animation); justChangedAnimation = true; animationPool.free(previous); previous = null; } if (justChangedAnimation) { target.calculateTransforms(); justChangedAnimation = false; } if (current == null || current.loopCount == 0 || current.animation == null) return; final float remain = current.update(delta); if (remain != 0f && queued != null) { inAction = false; animate(queued, queuedTransitionTime); queued = null; update(remain); return; } if (previous != null) applyAnimations(previous.animation, previous.offset + previous.time, current.animation, current.offset + current.time, transitionCurrentTime / transitionTargetTime); else applyAnimation(current.animation, current.offset + current.time); }