private void addSlotTimelineState(String timelineName) {
   Slot slot = _armature.getSlot(timelineName);
   if (slot != null && slot.getDisplayList().size() > 0) {
     for (SlotTimelineState eachState : _slotTimelineStateList) {
       if (Objects.equals(eachState.name, timelineName)) {
         return;
       }
     }
     SlotTimelineState timelineState = SlotTimelineState.borrowObject();
     timelineState.fadeIn(slot, this, _clip.getSlotTimeline(timelineName));
     _slotTimelineStateList.add(timelineState);
   }
 }
  void resetTimelineStateList() {
    int i = _timelineStateList.size();
    while (i-- > 0) {
      TimelineState.returnObject(_timelineStateList.get(i));
    }
    _timelineStateList.clear();

    i = _slotTimelineStateList.size();
    while (i-- > 0) {
      SlotTimelineState.returnObject(_slotTimelineStateList.get(i));
    }
    _slotTimelineStateList.clear();
  }
  private void advanceTimelinesTime(double passedTime) {
    if (_isPlaying && !_pausePlayheadInFade) {
      _time += passedTime;
    }

    boolean startFlg = false;
    boolean completeFlg = false;
    boolean loopCompleteFlg = false;
    boolean isThisComplete = false;
    int currentPlayTimes = 0;
    int currentTime = (int) (_time * 1000);
    if (_playTimes == 0) {
      isThisComplete = false;
      currentPlayTimes = (int) Math.ceil(Math.abs(currentTime) / _totalTime);
      if (currentPlayTimes == 0) currentPlayTimes = 1;
      // currentTime -= Math.floor(currentTime / _totalTime) * _totalTime;

      currentTime -= (int) (currentTime / _totalTime) * _totalTime;

      if (currentTime < 0) {
        currentTime += _totalTime;
      }
    } else {
      int totalTimes = _playTimes * _totalTime;
      if (currentTime >= totalTimes) {
        currentTime = totalTimes;
        isThisComplete = true;
      } else if (currentTime <= -totalTimes) {
        currentTime = -totalTimes;
        isThisComplete = true;
      } else {
        isThisComplete = false;
      }

      if (currentTime < 0) {
        currentTime += totalTimes;
      }

      currentPlayTimes = (int) Math.ceil(currentTime / _totalTime);
      if (currentPlayTimes == 0) currentPlayTimes = 1;
      // currentTime -= Math.floor(currentTime / _totalTime) * _totalTime;
      currentTime -= (int) (currentTime / _totalTime) * _totalTime;

      if (isThisComplete) {
        currentTime = _totalTime;
      }
    }

    // update timeline
    _isComplete = isThisComplete;
    double progress = _time * 1000 / _totalTime;
    for (TimelineState timeline : _timelineStateList) {
      timeline.update(progress);
      _isComplete = timeline._isComplete && _isComplete;
    }
    // update slotTimelie
    for (SlotTimelineState slotTimeline : _slotTimelineStateList) {
      slotTimeline.update(progress);
      _isComplete = slotTimeline._isComplete && _isComplete;
    }
    // update main timeline
    if (_currentTime != currentTime) {
      if (_currentPlayTimes != currentPlayTimes) // check loop complete
      {
        if (_currentPlayTimes > 0 && currentPlayTimes > 1) {
          loopCompleteFlg = true;
        }
        _currentPlayTimes = currentPlayTimes;
      }

      if (_currentTime < 0) // check start
      {
        startFlg = true;
      }

      if (_isComplete) // check complete
      {
        completeFlg = true;
      }
      _lastTime = _currentTime;
      _currentTime = currentTime;
      /*
      if(isThisComplete)
      {
      currentTime = _totalTime * 0.999999;
      }
      //[0, _totalTime)
      */
      updateMainTimeline(isThisComplete);
    }

    AnimationEvent event;
    if (startFlg) {
      if (_armature.hasEventListener(AnimationEvent.START)) {
        event = new AnimationEvent(AnimationEvent.START);
        event.animationState = this;
        _armature._eventList.add(event);
      }
    }

    if (completeFlg) {
      if (_armature.hasEventListener(AnimationEvent.COMPLETE)) {
        event = new AnimationEvent(AnimationEvent.COMPLETE);
        event.animationState = this;
        _armature._eventList.add(event);
      }
      if (autoFadeOut) {
        fadeOut(fadeOutTime, true);
      }
    } else if (loopCompleteFlg) {
      if (_armature.hasEventListener(AnimationEvent.LOOP_COMPLETE)) {
        event = new AnimationEvent(AnimationEvent.LOOP_COMPLETE);
        event.animationState = this;
        _armature._eventList.add(event);
      }
    }
  }
 private void removeSlotTimelineState(SlotTimelineState timelineState) {
   _slotTimelineStateList.remove(timelineState);
   SlotTimelineState.returnObject(timelineState);
 }