update method

void update(
  1. double dt
)

Implementation

void update(double dt) {
  if (pulseVariation <= 0) {
    phase = 0;
    value = 0;
    return;
  }

  // Normalize the step so `speed` keeps the same meaning it had when the
  // internal controller was expressed in `pulseVariation` units.
  final step = (dt * speed) / pulseVariation;

  phase += _animIsReverse ? -step : step;

  if (phase >= 1) {
    phase = 1;
    _animIsReverse = true;
  } else if (phase <= 0) {
    phase = 0;
    _animIsReverse = false;
  }

  value = curve.transform(phase) * pulseVariation;
}