apply method Null safety

  1. @override
void apply(
  1. RuntimeArtboard artboard,
  2. double elapsedSeconds
)
override

Apply animation to objects registered in core. Note that a core context is specified as animations can be applied to instances.

Implementation

@override
void apply(RuntimeArtboard artboard, double elapsedSeconds) {
  if (_stopOnNextApply || _instance == null) {
    isActive = false;
  }

  // We apply before advancing. So we want to stop rendering only once the
  // last advanced frame has been applied. This means tracking when the last
  // frame is advanced, ensuring the next apply happens, and then finally
  // stopping playback. We do this by tracking _stopOnNextApply making sure to
  // reset it when the controller is re-activated. Fixes #28 and should help
  // with issues #51 and #56.
  _instance!.animation
      .apply(_instance!.time, coreContext: artboard, mix: mix);
  if (!_instance!.advance(elapsedSeconds)) {
    _stopOnNextApply = true;
  }
}