Ejemplo n.º 1
0
  public void update(float delta) {
    delta *= timeScale;
    for (int i = 0; i < tracks.size; i++) {
      TrackEntry current = tracks.get(i);
      if (current == null) continue;

      float trackDelta = delta * current.timeScale;
      float time = current.time + trackDelta;
      float endTime = current.endTime;

      current.time = time;
      if (current.previous != null) {
        current.previous.time += trackDelta;
        current.mixTime += trackDelta;
      }

      // Check if completed the animation or a loop iteration.
      if (current.loop
          ? (current.lastTime % endTime > time % endTime)
          : (current.lastTime < endTime && time >= endTime)) {
        int count = (int) (time / endTime);
        if (current.listener != null) current.listener.complete(i, count);
        for (int ii = 0, nn = listeners.size; ii < nn; ii++) listeners.get(ii).complete(i, count);
      }

      TrackEntry next = current.next;
      if (next != null) {
        if (time - trackDelta > next.delay) setCurrent(i, next);
      } else {
        // End non-looping animation when it reaches its end time and there is no next entry.
        if (!current.loop && current.lastTime >= current.endTime) clearTrack(i);
      }
    }
  }
 /**
  * Removes all animations from all tracks, leaving skeletons in their previous pose.
  *
  * <p>It may be desired to use {@link AnimationState#setEmptyAnimations(float)} to mix the
  * skeletons back to the setup pose, rather than leaving them in their previous pose.
  */
 public void clearTracks() {
   boolean oldDrainDisabled = queue.drainDisabled;
   queue.drainDisabled = true;
   for (int i = 0, n = tracks.size; i < n; i++) clearTrack(i);
   tracks.clear();
   queue.drainDisabled = oldDrainDisabled;
   queue.drain();
 }
  public void update(float delta) {
    delta *= timeScale;
    for (int i = 0; i < tracks.size; i++) {
      TrackEntry current = tracks.get(i);
      if (current == null) continue;

      current.time += delta * current.timeScale;
      if (current.previous != null) {
        float previousDelta = delta * current.previous.timeScale;
        current.previous.time += previousDelta;
        current.mixTime += previousDelta;
      }

      TrackEntry next = current.next;
      if (next != null) {
        next.time = current.lastTime - next.delay;
        if (next.time >= 0) setCurrent(i, next);
      } else {
        // End non-looping animation when it reaches its end time and there is no next entry.
        if (!current.loop && current.lastTime >= current.endTime) clearTrack(i);
      }
    }
  }
Ejemplo n.º 4
0
 public void clearTracks() {
   for (int i = 0, n = tracks.size; i < n; i++) clearTrack(i);
   tracks.clear();
 }