computeCloseGlassScale static method
Effective uniform glass scale for a closing menu platter (Blob B) of
menuWidth returning into a trigger of shortest side minTriggerSide.
Matches _UIContextMenuView's 0.20 + 0.80 · u down to u = 0.24, then
tapers the 0.20 floor smoothly down to 0.56 · minTriggerSide / menuWidth
(~25 px for a 44 px trigger) so the retracting SDF droplet forms a
slender tail narrower than the trigger instead of stalling at 50 px.
Implementation
static double computeCloseGlassScale({
required double rawValue,
required double minTriggerSide,
required double menuWidth,
}) {
final u = rawValue.clamp(0.0, 1.0);
if (menuWidth <= 0.0) return (0.20 + 0.80 * u).clamp(0.08, 1.0);
final tailScale = (0.56 * minTriggerSide / menuWidth).clamp(0.08, 0.20);
final floor = tailScale + (0.20 - tailScale) * _smoothstep01(u / 0.24);
return (floor + (1.0 - floor) * u).clamp(0.08, 1.0);
}