LiquidMorphPhysics class

Pure, stateless math engine for iOS 27 liquid glass morphing animations.

Calibrated directly against 60 fps CADisplayLink CALayer.presentation() traces of native iOS 27 SwiftUI Menu, .popover, and .sheet morphs (_UIMorphAnimationContainerView, MagicMorphView, _UIContextMenuView).

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

closeTriggerWidthForElapsed(double elapsedSeconds, {double startWidthProgress = 0.0}) → double
Computes the wide-trigger centered width re-expansion progress (0.0 → 1.0 with +1.6% horizontal splash at ~400 ms) at speed-scaled elapsedSeconds (>= 0) during close.
compute({required double rawValue, required double finalDx, required double finalDy, double horizontalOffset = 0.0, double verticalOffset = 0.0, double scaleDelta = 1.0, bool? adaptiveDamping, bool isClosing = false, double? elapsedSeconds, bool hasHandedOff = false, bool isSettled = false, bool disableAnimations = false, double phaseStartTriggerWidth = 1.0, double closeStartProgress = 1.0, double recoilHalfTravelPx = defaultRecoilHalfTravelPx, bool verticalOnlyRecoil = false}) → LiquidMorphState
Computes the full LiquidMorphState for a single animation frame.
computeAdaptiveBackOutAmplitude({required double finalDy, double finalDx = 0.0, double baseAmplitude = _backOutAmplitude}) → double
Computes the adaptive J-curve back-out amplitude for a given Euclidean travel distance hypot(finalDx, finalDy).
computeBlendAttenuation(double scaleDelta) → double
Computes the SDF blend attenuation factor for a given scale ratio.
computeCloseBlend({required double rawValue}) → double
SDF smooth-union strength (blur units) between the closing platter and the trigger blob.
computeCloseBlobAEmergence({required Rect platterRect, required double platterRadius, required Offset triggerCenter, required double rawValue}) → double
Computes the gap-gated scale factor (0.0, or 0.45 → 1.0) for the trigger's ghost blob (Blob A) during close so it stays hidden while the droplet pulls away and emerges inside the smooth-union bridge reach with zero detached-dot frames.
computeCloseContentBlur({required double rawValue, double closeStartProgress = 1.0}) → double
Gaussian blur sigma (logical px) applied to the menu rows while the platter collapses on close.
computeCloseContentOpacity({required double rawValue, double closeStartProgress = 1.0}) → double
Computes the menu-row opacity while the platter collapses on close.
computeCloseCornerRadius({required Size currentSize, required Size restingSize, required double targetRadius, required double sizeProgress}) → double
Computes the corner radius of the closing platter (Blob B) while it collapses back into its trigger.
computeCloseDrift({required double elapsedSeconds, double menuHeight = 250.0, double closeStartProgress = 1.0}) → double
Close-phase displacement (logical px, always >= 0; callers multiply by the travel direction) of the retracting platter away from the trigger.
computeCloseGlassScale({required double rawValue, required double minTriggerSide, required double menuWidth}) → double
Effective uniform glass scale for a closing menu platter (Blob B) of menuWidth returning into a trigger of shortest side minTriggerSide.
computeCloseHeightEnvelope({required double coreHeight, required double rawValue, double restingHeight = 0.0}) → double
Absolute height envelope (logical px) of the closing glass blob: coreHeight + 400 · u^1.1 with u = rawValue, plus any excess restingHeight above coreHeight + 400 decaying rapidly as u^2.5.
computeClosingPlatterRect({required Offset pivot, required Rect restingRect, required double platterScale, double? maxHeight}) → Rect
Computes the rect of the closing platter (Blob B) as native iOS 27 does: a uniform scale of the resting menu rect by platterScale (0.2 + 0.8·rawValue) about the trigger centre pivot, where the pivot keeps its fractional position inside restingRect.
computeClosingTeardropGeometry({required double rawValue, required double pathT, required Offset triggerCenter, required Size triggerSize, required Rect restingRect, required double targetRadius, required Offset effectivePush, required double elapsedSeconds, double closeStartProgress = 1.0, double alignX = 0.0, bool disableAnimations = false, bool morphFromZero = false}) → ({double borderRadius, Rect rect})
Shared analytical close-phase geometry (rect and borderRadius) for trigger-anchored platters (GlassMenu and GlassPopover), combining uniform pivot scaling (computeClosingPlatterRect), slender tail taper (computeCloseGlassScale), tall-platter droplet height envelope (computeCloseHeightEnvelope), close neck drift (computeCloseDrift), diagonal-to-vertical tail convergence, and outer-edge non-overshoot.
computeCornerRadius({required Size currentSize, required double triggerRadius, required double targetRadius, required double progress}) → double
Computes a monotonic corner radius for a morphing glass surface of currentSize, interpolating smoothly from triggerRadius (progress = 0) to targetRadius (progress = 1).
computeMenuOpenSizeProgress(double rawValue) → double
Open size progress of a large GlassMenu morph (scaleDelta > 3) as a function of the open spring's rawValue (0 – 1).
computeOpenContentBlur({required double elapsedSeconds, double openStartProgress = 0.0}) → double
Gaussian blur sigma (logical px) of the menu rows while the platter opens: soft until ~130 ms, sharp by ~230 ms (native text arrives smeared and resolves as the bubble relaxes), capped at _closeContentBlurMaxSigma.
computeOpenContentOpacity({required double elapsedSeconds, double openStartProgress = 0.0}) → double
Menu-row opacity while the platter opens, driven by phase time.
computeOpenCornerRadius({required Size currentSize, required Size restingSize, required double targetRadius, required double elapsedSeconds, double openStartProgress = 0.0}) → double
Computes the corner radius of the opening platter from the time since the open began.
computeOpenDrift({required double elapsedSeconds, double menuHeight = 520.0, double openStartProgress = 0.0}) → double
Vertical open drift (logical px, signed by nothing — callers multiply by the travel direction) of the opening platter past its resting position.
computeScaleDelta({required Size sourceSize, required Size targetSize}) → double
Computes the geometric scale ratio from sourceSize to targetSize: Δ_scale = √(targetArea / sourceArea).
impactScaleForElapsed({required Offset travel, required double elapsedSeconds, double closeStartProgress = 1.0}) → double
Computes the tactile trigger impact scale (~0.96–1.0) at speed-scaled elapsedSeconds (>= 0) during close.
recoilOffsetForElapsed({required Offset travel, required double elapsedSeconds, double closeStartProgress = 1.0, double recoilHalfTravelPx = defaultRecoilHalfTravelPx, bool verticalOnlyRecoil = false}) → Offset
Computes the parallel close trigger recoil offset (logical px) at speed-scaled elapsedSeconds (>= 0) for a trigger-to-platter travel vector, using a near-constant ~17 px peak at ~183 ms.

Constants

closeSpring → const SpringDescription
Spring profile for the iOS 27 liquid morph closing platter animation (ω₀ = 18.0 rad/s, ζ ≈ 0.86, response ≈ 0.35 s).
closeVelocityHint → const double
Initial velocity hint injected when the close animation starts.
defaultRecoilHalfTravelPx → const double
Half-saturation travel for popovers, sheets and custom morphs (proportional kick, the original calibration).
Half-saturation travel for menus (near-constant native kick).
openSpring → const SpringDescription
Spring profile for the iOS 27 liquid morph opening animation (ω₀ = 17.0 rad/s, ζ ≈ 0.76, response ≈ 0.37 s).