elapseTime method
Advance the simulation by seconds.
Implementation
void elapseTime(double seconds) {
if (isDone) return;
double secondsRemaining = seconds;
const maxStepSize = 1.0 / 60.0;
while (secondsRemaining > 0.0) {
final stepSize = secondsRemaining > maxStepSize
? maxStepSize
: secondsRemaining;
// THE KEY FEATURE: acceleration ramp.
// Grows from 0→1 at rate 6.0/s. At 60fps that's 0→1 in ~10 frames (167ms).
// This is why Fuchsia springs start gentle instead of yanking.
_accelerationMultiplier = math.min(
1.0,
_accelerationMultiplier + stepSize * 6.0,
);
if (_evaluateRK(stepSize)) {
_curT = 1.0;
_value = _target;
_velocity = 0.0;
_isDone = true;
_accelerationMultiplier = 0.0;
return;
}
secondsRemaining -= maxStepSize;
}
_value = _startValue + _curT * _delta;
}