setAnimationWith method

TrackEntry? setAnimationWith(
  1. int trackIndex,
  2. Animation animation,
  3. bool loop
)

Implementation

TrackEntry? setAnimationWith(int trackIndex, Animation animation, bool loop) {
  bool interrupt = true;
  TrackEntry? current = expandToIndex(trackIndex);
  if (current != null) {
    if (current.nextTrackLast == -1) {
      // Don't mix from an entry that was never applied.
      tracks[trackIndex] = current.mixingFrom;
      queue
        ..interrupt(current)
        ..end(current);
      disposeNext(current);
      current = current.mixingFrom;
      interrupt = false;
    } else {
      disposeNext(current);
    }
  }
  final TrackEntry? entry = trackEntry(trackIndex, animation, loop, current);
  setCurrent(trackIndex, entry, interrupt);
  queue.drain();
  return entry;
}