Skip to main content

waft_material/generated/
motion_defaults_m3e.rs

1//! Port of material_ui's `generated/motion_defaults_m3e.g.dart`: a Dart `part` of `motion.dart`, so its items are public through `motion.rs`.
2//!
3//! Generated from the Material token database upstream; port changes to the Dart generator's output by hand.
4
5use waft_physics::SpringDescription;
6
7/// The set of springs in the Material specification.
8///
9/// Material 3 Expressive motion uses springs, grouped into two motion schemes.
10/// The standard scheme eases into place with minimal bounce, and suits more
11/// utilitarian products. The expressive scheme overshoots and bounces into
12/// place, and suits hero moments and key interactions.
13///
14/// Each scheme has springs for two types of motion, in three speeds: default,
15/// fast, and slow.
16///
17/// * Spatial springs animate movement, such as position, size, rotation, and
18///   corner radius.
19/// * Effects springs animate properties that shouldn't overshoot, such as
20///   color and opacity.
21///
22/// Most motion should use the default speed. Smaller elements can use the fast
23/// speed, and larger elements can use the slow speed.
24///
25/// Material spring tokens define a stiffness and a damping ratio, but no
26/// mass. The Material token named `damping` is the damping ratio (ΞΆ), not
27/// `SpringDescription.damping`. Each constant is the same as
28/// `SpringDescription.withDampingRatio` with a mass of 1.0 and the token's
29/// stiffness and damping ratio, so its damping is
30/// `ratio * 2.0 * sqrt(stiffness)`. For example, `STANDARD_DEFAULT_SPATIAL` has
31/// a damping of `0.9 * 2.0 * sqrt(700.0)`, about 47.62.
32///
33/// Use them with a `SpringSimulation`, for example through
34/// `AnimationController.animateWith`.
35///
36/// See also:
37///
38/// * `Durations` and `Easing`, which are the Material tokens for curve-based
39///   animations.
40/// * [M3 guidelines: Motion physics system](https://m3.material.io/styles/motion/overview/how-it-works)
41/// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
42pub enum Springs {}
43
44impl Springs {
45    /// The standard default spatial spring in the Material specification.
46    ///
47    /// It has a stiffness of 700.0 and a damping ratio of 0.9.
48    ///
49    /// See also:
50    ///
51    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
52    pub const STANDARD_DEFAULT_SPATIAL: SpringDescription =
53        SpringDescription::new(1.0, 700.0, 47.62352359916263);
54
55    /// The standard fast spatial spring in the Material specification.
56    ///
57    /// It has a stiffness of 1400.0 and a damping ratio of 0.9.
58    ///
59    /// See also:
60    ///
61    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
62    pub const STANDARD_FAST_SPATIAL: SpringDescription =
63        SpringDescription::new(1.0, 1400.0, 67.34983296193096);
64
65    /// The standard slow spatial spring in the Material specification.
66    ///
67    /// It has a stiffness of 300.0 and a damping ratio of 0.9.
68    ///
69    /// See also:
70    ///
71    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
72    pub const STANDARD_SLOW_SPATIAL: SpringDescription =
73        SpringDescription::new(1.0, 300.0, 31.176914536239796);
74
75    /// The standard default effects spring in the Material specification.
76    ///
77    /// It has a stiffness of 1600.0 and a damping ratio of 1.0.
78    ///
79    /// See also:
80    ///
81    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
82    pub const STANDARD_DEFAULT_EFFECTS: SpringDescription =
83        SpringDescription::new(1.0, 1600.0, 80.0);
84
85    /// The standard fast effects spring in the Material specification.
86    ///
87    /// It has a stiffness of 3800.0 and a damping ratio of 1.0.
88    ///
89    /// See also:
90    ///
91    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
92    pub const STANDARD_FAST_EFFECTS: SpringDescription =
93        SpringDescription::new(1.0, 3800.0, 123.28828005937953);
94
95    /// The standard slow effects spring in the Material specification.
96    ///
97    /// It has a stiffness of 800.0 and a damping ratio of 1.0.
98    ///
99    /// See also:
100    ///
101    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
102    pub const STANDARD_SLOW_EFFECTS: SpringDescription =
103        SpringDescription::new(1.0, 800.0, 56.568542494923804);
104
105    /// The expressive default spatial spring in the Material specification.
106    ///
107    /// It has a stiffness of 380.0 and a damping ratio of 0.8.
108    ///
109    /// See also:
110    ///
111    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
112    pub const EXPRESSIVE_DEFAULT_SPATIAL: SpringDescription =
113        SpringDescription::new(1.0, 380.0, 31.189741903388683);
114
115    /// The expressive fast spatial spring in the Material specification.
116    ///
117    /// It has a stiffness of 800.0 and a damping ratio of 0.6.
118    ///
119    /// See also:
120    ///
121    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
122    pub const EXPRESSIVE_FAST_SPATIAL: SpringDescription =
123        SpringDescription::new(1.0, 800.0, 33.94112549695428);
124
125    /// The expressive slow spatial spring in the Material specification.
126    ///
127    /// It has a stiffness of 200.0 and a damping ratio of 0.8.
128    ///
129    /// See also:
130    ///
131    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
132    pub const EXPRESSIVE_SLOW_SPATIAL: SpringDescription =
133        SpringDescription::new(1.0, 200.0, 22.627416997969522);
134
135    /// The expressive default effects spring in the Material specification.
136    ///
137    /// It has a stiffness of 1600.0 and a damping ratio of 1.0.
138    ///
139    /// See also:
140    ///
141    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
142    pub const EXPRESSIVE_DEFAULT_EFFECTS: SpringDescription =
143        SpringDescription::new(1.0, 1600.0, 80.0);
144
145    /// The expressive fast effects spring in the Material specification.
146    ///
147    /// It has a stiffness of 3800.0 and a damping ratio of 1.0.
148    ///
149    /// See also:
150    ///
151    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
152    pub const EXPRESSIVE_FAST_EFFECTS: SpringDescription =
153        SpringDescription::new(1.0, 3800.0, 123.28828005937953);
154
155    /// The expressive slow effects spring in the Material specification.
156    ///
157    /// It has a stiffness of 800.0 and a damping ratio of 1.0.
158    ///
159    /// See also:
160    ///
161    /// * [M3 guidelines: Spring tokens](https://m3.material.io/styles/motion/overview/specs)
162    pub const EXPRESSIVE_SLOW_EFFECTS: SpringDescription =
163        SpringDescription::new(1.0, 800.0, 56.568542494923804);
164}