/** * Adds an empty animation to be played after the current or last queued animation for a track, * and sets the track entry's {@link TrackEntry#getMixDuration()}. If the track is empty, it is * equivalent to calling {@link #setEmptyAnimation(int, float)}. * * @param delay Seconds to begin this animation after the start of the previous animation. May be * <= 0 to use the animation duration of the previous track minus any mix duration plus <code> * delay</code>. * @return A track entry to allow further customization of animation playback. References to the * track entry must not be kept after the {@link AnimationStateListener#dispose(TrackEntry)} * event occurs. */ public TrackEntry addEmptyAnimation(int trackIndex, float mixDuration, float delay) { if (delay <= 0) delay -= mixDuration; TrackEntry entry = addAnimation(trackIndex, emptyAnimation, false, delay); entry.mixDuration = mixDuration; entry.trackEnd = mixDuration; return entry; }
/** @param last May be null. */ private TrackEntry trackEntry( int trackIndex, Animation animation, boolean loop, TrackEntry last) { TrackEntry entry = trackEntryPool.obtain(); entry.trackIndex = trackIndex; entry.animation = animation; entry.loop = loop; entry.eventThreshold = 0; entry.attachmentThreshold = 0; entry.drawOrderThreshold = 0; entry.animationStart = 0; entry.animationEnd = animation.getDuration(); entry.animationLast = -1; entry.nextAnimationLast = -1; entry.delay = 0; entry.trackTime = 0; entry.trackLast = -1; entry.nextTrackLast = -1; entry.trackEnd = Float.MAX_VALUE; entry.timeScale = 1; entry.alpha = 1; entry.mixAlpha = 1; entry.mixTime = 0; entry.mixDuration = last == null ? 0 : data.getMix(last.animation, animation); return entry; }
/** * Sets an empty animation for a track, discarding any queued animations, and sets the track * entry's {@link TrackEntry#getMixDuration()}. * * <p>Mixing out is done by setting an empty animation. A mix duration of 0 still mixes out over * one frame. * * <p>To mix in, first set an empty animation and add an animation using {@link #addAnimation(int, * Animation, boolean, float)}, then set the {@link TrackEntry#setMixDuration(float)} on the * returned track entry. */ public TrackEntry setEmptyAnimation(int trackIndex, float mixDuration) { TrackEntry entry = setAnimation(trackIndex, emptyAnimation, false); entry.mixDuration = mixDuration; entry.trackEnd = mixDuration; return entry; }