computeAdaptiveBackOutAmplitude static method
Computes the adaptive J-curve back-out amplitude for a given Euclidean
travel distance hypot(finalDx, finalDy).
For travel <= 100 px, returns baseAmplitude (2.5) unchanged. For
larger travel distances, reduces inversely so physical overshoot stays
within a tight native envelope on both horizontal and vertical axes,
floored at _minBackOutAmplitude (0.7).
Implementation
static double computeAdaptiveBackOutAmplitude({
required double finalDy,
double finalDx = 0.0,
double baseAmplitude = _backOutAmplitude,
}) {
final travel = math.sqrt(finalDx * finalDx + finalDy * finalDy);
if (travel <= _adaptiveThresholdTravel) return baseAmplitude;
return (baseAmplitude * _adaptiveThresholdTravel / travel)
.clamp(_minBackOutAmplitude, baseAmplitude);
}