advance method

bool advance(
  1. double elapsedSeconds,
  2. {bool nested = false}
)

Update any dirty components in this artboard.

Implementation

bool advance(double elapsedSeconds, {bool nested = false}) {
  bool didUpdate = false;
  for (final controller in _animationControllers) {
    if (controller.isActive) {
      controller.apply(context, elapsedSeconds);
      didUpdate = true;
    }
  }
  hasChangedDrawOrderInLastUpdate = false;

  // Joysticks can be applied before updating components if none of the
  // joysticks have "external" control. If they are controlled/moved by some
  // other component then they need to apply after the update cycle, which is
  // less efficient.
  var canApplyJoysticksEarly = canPreApplyJoysticks();
  if (canApplyJoysticksEarly) {
    applyJoysticks();
  }

  if (updateComponents() || didUpdate) {
    didUpdate = true;
  }

  // If joysticks applied, run the update again for the animation changes.
  if (!canApplyJoysticksEarly && applyJoysticks()) {
    if (updateComponents()) {
      didUpdate = true;
    }
  }

  if (nested) {
    var active = _activeNestedArtboards.toList(growable: false);
    for (final activeNestedArtboard in active) {
      if (activeNestedArtboard.advance(elapsedSeconds)) {
        didUpdate = true;
      }
    }
  }

  return didUpdate;
}