computeCloseDrift static method
Close-phase displacement (logical px, always >= 0; callers multiply by
the travel direction) of the retracting platter away from the trigger.
Native's visible glass (MM1 neck container) is pushed ~49 pt away
from the trigger within ~75 ms of the close starting, then springs back
by ~300 ms (traced MM1 ty: 31.8 @ 67 ms, 48.6 @ 100, 36.6 @ 150, 17.7 @ 200, 6.7 @ 250). That gap is what the metaball bridge stretches
into the teardrop's narrow neck; without it the platter overlaps the
trigger and reads as a round egg.
Closed form fitted to the 60 fps trace (0.35 px RMS):
A · S(τ; ω = 20, ζ = 1) · (1 − S(τ; ω = 24, ζ = 1)), peaking
≈ 49 px at 250 pt (≈ 62 px at 521 pt), tapering smoothly toward
0 for compact (< 250 pt) menus so short 1–2 item platters never dip
past their resting bottom, and scaled by closeStartProgress on partial
mid-open cancellations.
Implementation
static double computeCloseDrift({
required double elapsedSeconds,
double menuHeight = 250.0,
double closeStartProgress = 1.0,
}) {
if (elapsedSeconds <= 0.0 || closeStartProgress <= 0.001) return 0.0;
final unit = _stepResponse(elapsedSeconds, 20.0, 1.0) *
(1.0 - _stepResponse(elapsedSeconds, 24.0, 1.0));
final double peak;
if (menuHeight < 250.0) {
final shortF = ((menuHeight - 95.0) / 155.0).clamp(0.0, 1.0);
peak = _closeDriftPeakPx * shortF;
} else {
final heightF = ((menuHeight - 250.0) / 270.0).clamp(0.0, 1.0);
peak = _closeDriftPeakPx +
(_closeDriftPeakTallPx - _closeDriftPeakPx) * heightF;
}
return peak *
unit /
_closeDriftUnitPeak *
closeStartProgress.clamp(0.0, 1.0);
}