IndicatorJellyPhysics class
Tunable physics for the iOS 26/27 tab-bar selection lens "jelly".
Pass it as indicatorJelly on GlassTabBar or GlassSegmentedControl
to change the motion, or use IndicatorJellyPhysics.disabled to keep the
classic velocity squash.
The defaults were measured from UIKit: a native UITabBar on the iOS 27.2
simulator, tapped through XCUITest, with the selection lens' presentation
geometry logged every frame. They describe three motions:
- Travel stretch — after a tap, the edge facing the destination is pulled ahead of the moving pill (travelStretch) while the pill thins vertically (travelThinning, travelFlatten). It peaks ≈0.15 s into the travel at ≈12 % of the lens width, whatever the distance.
- Landing squish — the trailing edge follows its own, slower spring (trailingDuration, trailingBounce) and overshoots the leading edge as the pill lands, so the pill narrows and bulges (compressionBulge). The squish grows with distance: ≈0.95× after one tab, ≈0.9× after two and ≈0.8× after four, peaking ≈0.45 s after the tap. It comes almost entirely from the trailing side (squishAnchor), and at the ends of the bar the leading edge stays pinned to the last cell.
- Drag — while a finger drags the pill, an acceleration-driven damped
oscillator fitted to
_UILiquidLensViewstretches the pill on speed-up (maxDragStretch, dragThinning), relaxes back to rest at steady drag speed, and squishes narrower while bulging vertically on deceleration or direction reversal.
Lengths are fractions of the lens width.
- Annotations
Constructors
- IndicatorJellyPhysics({bool enabled = true, double travelStretch = 0.19, Duration travelStretchDuration = const Duration(milliseconds: 410), double travelStretchBounce = 0.15, Duration travelStretchHold = const Duration(milliseconds: 120), Duration travelStretchRelaxDuration = const Duration(milliseconds: 325), double travelThinning = 0.55, double travelFlatten = 0.04, Duration travelFlattenDuration = const Duration(milliseconds: 350), Duration travelFlattenHold = const Duration(milliseconds: 280), Duration travelFlattenRelaxDuration = const Duration(milliseconds: 200), Duration trailingDuration = const Duration(milliseconds: 660), double trailingBounce = 0.31, double squishAnchor = 0.95, double compressionBulge = 1.15, double maxCompression = 0.4, Duration dragTrailingDuration = const Duration(milliseconds: 140), double maxDragStretch = 0.12, double dragThinning = 0.65})
-
Creates jelly physics. Every value defaults to the measured native
motion.
const
Properties
- compressionBulge → double
-
Vertical bulge per unit of landing squish.
final
- dragThinning → double
-
Vertical thinning per unit of drag stretch.
final
- dragTrailingDuration → Duration
-
Duration of the critically damped trailing-edge spring while dragging.
final
- enabled → bool
-
Whether the jelly runs at all. When
falsethe indicator keeps the classic velocity squash.final - hashCode → int
-
The hash code for this object.
no setteroverride
- maxCompression → double
-
Largest landing squish.
final
- maxDragStretch → double
-
Largest drag stretch; the trailing edge's lag is soft-limited toward it.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- squishAnchor → double
-
Where the landing squish is anchored, from
0(the centre) to1(the leading edge stays fully pinned).final - trailingBounce → double
-
Bounce of the trailing-edge spring; its overshoot past the leading edge
is the landing squish.
final
- trailingDuration → Duration
-
Duration of the trailing-edge spring after a tap or a drag release.
final
- travelFlatten → double
-
Extra vertical flattening while the pill travels after a tap.
final
- travelFlattenDuration → Duration
-
Duration of the critically damped spring that raises travelFlatten.
final
- travelFlattenHold → Duration
-
How long after the tap the flattening starts to relax.
final
- travelFlattenRelaxDuration → Duration
-
Duration of the critically damped spring that relaxes the flattening.
final
- travelStretch → double
-
Forward stretch the travel pulse heads for after a tap. The pulse is
released after travelStretchHold, so the visible peak is lower
(≈0.12 with the default timing).
final
- travelStretchBounce → double
-
Bounce of the spring that raises the travel stretch.
final
- travelStretchDuration → Duration
-
Duration of the spring that raises the travel stretch.
final
- travelStretchHold → Duration
-
How long after the tap the travel stretch starts to relax.
final
- travelStretchRelaxDuration → Duration
-
Duration of the critically damped spring that relaxes the travel
stretch.
final
- travelThinning → double
-
Vertical thinning per unit of travel stretch.
final
Methods
-
copyWith(
{bool? enabled, double? travelStretch, Duration? travelStretchDuration, double? travelStretchBounce, Duration? travelStretchHold, Duration? travelStretchRelaxDuration, double? travelThinning, double? travelFlatten, Duration? travelFlattenDuration, Duration? travelFlattenHold, Duration? travelFlattenRelaxDuration, Duration? trailingDuration, double? trailingBounce, double? squishAnchor, double? compressionBulge, double? maxCompression, Duration? dragTrailingDuration, double? maxDragStretch, double? dragThinning}) → IndicatorJellyPhysics - Returns a copy with the given values replaced.
-
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.
override
Constants
- disabled → const IndicatorJellyPhysics
- No jelly: the indicator keeps the classic velocity squash.
- native → const IndicatorJellyPhysics
- The measured native motion (the default).