tick method

bool tick()

Advances the animation tick frame. Returns true if ticking should continue.

Implementation

bool tick() {
  if (!isAnimating) return false;

  final stopwatch = _stopwatch;
  if (stopwatch == null) return false;

  final currentRaw = rawProgress;
  final elapsed = stopwatch.elapsedMilliseconds;

  if (status == AnimationStatus.forward && currentRaw >= 1.0) {
    status = AnimationStatus.completed;
    stopwatch.stop();
    onUpdate?.call();
    return false;
  } else if (status == AnimationStatus.reverse && currentRaw <= 0.0) {
    status = AnimationStatus.dismissed;
    stopwatch.stop();
    _stopwatch = null;
    onUpdate?.call();
    return false;
  }

  final elapsedSinceLastFrame = elapsed - _lastFrameTimeMs;
  if (elapsedSinceLastFrame >= targetFrameInterval.inMilliseconds) {
    _lastFrameTimeMs = elapsed;
    onUpdate?.call();
  }

  return true;
}