animateTo method

Cmd animateTo(
  1. double target, {
  2. Duration? duration,
  3. Curve curve = Curves.linear,
})

Animates to target with optional duration and curve overrides.

Returns a Cmd that schedules the first animation frame tick.

Implementation

Cmd animateTo(
  double target, {
  Duration? duration,
  Curve curve = Curves.linear,
}) {
  _targetValue = target.clamp(lowerBound, upperBound);
  _startValue = _value;
  _curve = curve;
  if (duration != null) this.duration = duration;
  _status = target >= _value
      ? AnimationStatus.forward
      : AnimationStatus.reverse;
  _startTime = null;
  _repeating = false;
  _notifyStatusListeners();
  return _scheduleTick();
}