advance method

  1. @override
double advance(
  1. double dt
)
override

Advances this controller's internal clock by dt seconds.

If the controller is still running, the return value will be 0. If it already finished, then the return value will be the "leftover" part of the dt. That is, the amount of time dt that remains after the controller has finished. In all cases, the return value can be positive only when completed == true.

Normally, this method will be called by the owner of the controller class. For example, if the controller is passed to an Effect class, then that class will take care of calling this method as necessary.

Implementation

@override
double advance(double dt) {
  if (!_initialized) {
    _initialized = true;
    final measure = _parentEffect.measure();
    assert(
      measure >= 0,
      'negative measure returned by ${_parentEffect.runtimeType}: $measure',
    );
    child.duration = measure / speed;
  }
  return child.advance(dt);
}