GlassMotionConstants class
Motion constants for .interactive() and glassId morphs.
- Annotations
Constructors
- GlassMotionConstants({required double pressGrowthArea, required double pressScaleMax, required double pressStretch, required double glowRadius, required double pressResponse, required double pressDamping, required double releaseResponse, required double releaseDamping, required double morphResponse, required double morphDamping, double dragStretch = 0.08, double dragStretchDistance = 60, double pressGrowthLength = 0, double pressSmallGrowth = 0, double pressSmallLength = 0, double smallReleaseResponse = 0, double smallReleaseDamping = 0})
-
Creates motion constants.
const
-
GlassMotionConstants.fromJson(Map<
String, Object?> j, GlassMotionConstants base) -
Reads keys present in
j; missing keys come frombase.factory
Properties
- dragStretch → double
-
Largest extra scale along an axis when the finger is dragged past the
pressed shape's edge on that axis: the shape rubber-bands toward the
finger, its opposite edge anchored. Estimated by eye from iOS 26
buttons, not measured.
final
- dragStretchDistance → double
-
Drag distance (pt) past the edge at which the stretch reaches
1 − 1/e(63 %) of dragStretch; further drags add less and less. Estimated, not measured.final - glowRadius → double
-
Radius of the touch glow.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- morphDamping → double
-
SwiftUI damping fraction for morphs.
final
- morphResponse → double
-
SwiftUI spring response for morphs.
final
- pressDamping → double
-
SwiftUI damping fraction for the press-in.
final
- pressGrowthArea → double
-
Area (pt²) a pressed shape gains at full press: its uniform scale is
sqrt(1 + pressGrowthArea / (w·h)), capped at pressScaleMax, so small shapes grow more than large ones.final - pressGrowthLength → double
-
When positive, replaces pressGrowthArea: a pressed shape's long side
grows by
pressGrowthLength / sqrt(short side)points (uniform scale1 + pressGrowthLength / (long · sqrt(short))), capped at pressScaleMax. Fits SwiftUI's capsules better than a fixed area.final - pressResponse → double
-
SwiftUI spring response for the press-in.
final
- pressScaleMax → double
-
Largest uniform press scale.
final
- pressSmallGrowth → double
-
Points a pressed small shape's long side grows by (uniform scale
1 + pressSmallGrowth / long, capped at pressScaleMax) when that side is under pressSmallLength: SwiftUI presses small controls in a regime of their own, a fixed growth and a frost. 0 turns it off.final - pressSmallLength → double
-
Long side (pt) below which pressSmallGrowth applies.
final
- pressStretch → double
-
Extra scale along the touch direction at full press.
final
- releaseDamping → double
-
SwiftUI damping fraction for the release.
final
- releaseResponse → double
-
SwiftUI spring response for the release.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- smallReleaseDamping → double
-
When positive, the release damping fraction of a shape whose long side
is under pressSmallLength.
final
- smallReleaseResponse → double
-
When positive, the release response of a shape whose long side is
under pressSmallLength: SwiftUI releases small controls with a
springier spring than large ones.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, double> - JSON form.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override