apply method

  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 (_instance == null || !_instance!.keepGoing) {
    isActive = false;
  }

  // We apply before advancing. So we want to stop rendering only once the
  // last advanced frame has been applied. This means knowing when the last
  // frame is advanced, ensuring the next apply happens, and then finally
  // stopping playback. We do this with keepGoing as this will be true of a
  // one-shot has passed its stop time. Fixes #28 and should help with issues
  // #51 and #56.
  _instance!
    ..animation.apply(_instance!.time, coreContext: artboard, mix: mix)
    ..advance(elapsedSeconds);
}