computeOpenDrift static method

double computeOpenDrift({
  1. required double elapsedSeconds,
  2. double menuHeight = 520.0,
  3. double openStartProgress = 0.0,
})

Vertical open drift (logical px, signed by nothing — callers multiply by the travel direction) of the opening platter past its resting position.

Native iOS 27's visible glass is dragged by the background CASDFLayer neck container (MM1 TransformView), whose traced ty rises to +46.9 pt and springs back with a small −2 pt undershoot. A closed-form two-spring fit to the 60 fps trace (0.8 px RMS) is A · [S(τ; ω = 24, ζ = 0.6) − S(τ; ω = 20, ζ = 0.9)], peaking ~110 ms after onset. Starting strictly at 0.0 (elapsedSeconds == 0) and scaling down for compact (< 250 pt) menus (~13.7 pt native peak on a 2-item 104 pt menu) and partial mid-close reopens (openStartProgress) keeps open trajectories C¹ smooth and proportional across all heights.

Implementation

static double computeOpenDrift({
  required double elapsedSeconds,
  double menuHeight = 520.0,
  double openStartProgress = 0.0,
}) {
  if (elapsedSeconds <= 0.0) return 0.0;
  final diff = _stepResponse(elapsedSeconds, 24.0, 0.6) -
      _stepResponse(elapsedSeconds, 20.0, 0.9);
  // The traced tail undershoots by ~2 pt and decays over ~700 ms, but the
  // open controller settles at ~420 ms. Fade the pulse to exactly zero by
  // 0.40 s so a settled menu never rests off its true position.
  final fade = 1.0 - _smoothstep01((elapsedSeconds - 0.26) / 0.14);
  final double peak;
  if (menuHeight < 250.0) {
    // Compact menus (< 250 pt): native 2-item (104 pt) peaks at ~13.7 pt
    // rather than 66 pt; taper smoothly down to 0 below trigger height (48 pt).
    final tinyScale = ((menuHeight - 48.0) / 56.0).clamp(0.0, 1.0);
    final compactBase = _openDriftPeakCompactPx * tinyScale;
    final shortF = ((menuHeight - 104.0) / 146.0).clamp(0.0, 1.0);
    peak = compactBase + (_openDriftPeakMediumPx - compactBase) * shortF;
  } else {
    final heightF = ((menuHeight - 250.0) / 270.0).clamp(0.0, 1.0);
    peak = _openDriftPeakMediumPx +
        (_openDriftPeakPx - _openDriftPeakMediumPx) * heightF;
  }
  final remainingTravel = 1.0 - openStartProgress.clamp(0.0, 1.0);
  return peak * diff / _openDriftUnitPeak * fade * remainingTravel;
}