computeAdaptiveBackOutAmplitude static method

double computeAdaptiveBackOutAmplitude({
  1. required double finalDy,
  2. double baseAmplitude = _backOutAmplitude,
})

Computes the adaptive J-curve back-out amplitude for a given vertical travel distance.

For |finalDy| <= 100 px (small controls), returns baseAmplitude (2.5) unchanged. For larger travel distances the amplitude is reduced inversely so the peak physical overshoot stays within ~10–14 px instead of plunging 35–40 px.

The result is never lower than _minBackOutAmplitude (0.7), preserving enough J-curve for a visible teardrop neck.

Implementation

static double computeAdaptiveBackOutAmplitude({
  required double finalDy,
  double baseAmplitude = _backOutAmplitude,
}) {
  final absDy = finalDy.abs();
  if (absDy <= _adaptiveThresholdDy) return baseAmplitude;
  return (baseAmplitude * _adaptiveThresholdDy / absDy)
      .clamp(_minBackOutAmplitude, baseAmplitude);
}