clusterPhaseAt static method

double clusterPhaseAt({
  1. required bool inFrom,
  2. required bool inTo,
  3. required double progress,
})

The materialize phase of a cluster at transition progress: 0.0 = fully dematerialized (not built), 1.0 = settled glass.

A cluster only the incoming route has materializes over the tail of the transition; one only the outgoing route has dematerializes over the head. Both are pure functions of progress, so a pop — which runs the same value backwards — plays each window in reverse and the exit still leads the entrance in both directions, with no direction to get wrong.

progress is not raw route progress during an interactive back-swipe: the shell holds it still until the gesture commits and then re-times it over the remaining travel, so the chrome never dissolves under a finger that may yet be lifted. See GlassNavigationShellState._holdForGesture.

The windows are symmetric on purpose. The native asymmetry — an exit that lingers past its entrance — lives in the effect's own sub-curves, where it survives a reversed transition; encoding it here as direction-aware windows would snap when a swipe reverses mid-flight, for the same reason the capsule's geometry curve is symmetric.

Implementation

static double clusterPhaseAt({
  required bool inFrom,
  required bool inTo,
  required double progress,
}) {
  if (inFrom && inTo) return 1.0;
  if (!inFrom && !inTo) return 0.0;
  if (inTo) {
    return ((progress - materializeStart) / (1.0 - materializeStart))
        .clamp(0.0, 1.0);
  }
  return 1.0 - (progress / dematerializeEnd).clamp(0.0, 1.0);
}