public void ClearTrack(int trackIndex)
        {
            if (trackIndex >= tracks.Count)
            {
                return;
            }
            TrackEntry current = tracks.Items[trackIndex];

            if (current == null)
            {
                return;
            }

            current.OnEnd(this, trackIndex);
            if (End != null)
            {
                End(this, trackIndex);
            }

            tracks.Items[trackIndex] = null;
        }
        private void SetCurrent(int index, TrackEntry entry)
        {
            TrackEntry current = ExpandToIndex(index);

            if (current != null)
            {
                TrackEntry previous = current.previous;
                current.previous = null;

                current.OnEnd(this, index);
                if (End != null)
                {
                    End(this, index);
                }

                entry.mixDuration = data.GetMix(current.animation, entry.animation);
                if (entry.mixDuration > 0)
                {
                    entry.mixTime = 0;
                    // If a mix is in progress, mix from the closest animation.
                    if (previous != null && current.mixTime / current.mixDuration < 0.5f)
                    {
                        entry.previous = previous;
                    }
                    else
                    {
                        entry.previous = current;
                    }
                }
            }

            tracks.Items[index] = entry;

            entry.OnStart(this, index);
            if (Start != null)
            {
                Start(this, index);
            }
        }