Fluid 1.3.0
Material Design for QtQuick and Qml
Loading...
Searching...
No Matches
motiontokens.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
2// SPDX-License-Identifier: MPL-2.0
3
4#pragma once
5
6#include <QtCore/qobject.h>
7#include <QtQml/qqmlregistration.h>
8
9namespace Fluid {
10
12{
13 Q_GADGET
14 QML_ANONYMOUS
15
16 Q_PROPERTY(qreal x1 MEMBER x1 CONSTANT FINAL)
17 Q_PROPERTY(qreal y1 MEMBER y1 CONSTANT FINAL)
18 Q_PROPERTY(qreal x2 MEMBER x2 CONSTANT FINAL)
19 Q_PROPERTY(qreal y2 MEMBER y2 CONSTANT FINAL)
20
21public:
22 constexpr MotionEasingValue(qreal x1 = 0.0, qreal y1 = 0.0, qreal x2 = 1.0, qreal y2 = 1.0)
23 : x1(x1)
24 , y1(y1)
25 , x2(x2)
26 , y2(y2)
27 {
28 }
29
30 qreal x1;
31 qreal y1;
32 qreal x2;
33 qreal y2;
34};
35
45{
46 Q_GADGET
47 QML_ANONYMOUS
48
49 Q_PROPERTY(qreal extraLong1 READ extraLong1 CONSTANT FINAL)
50 Q_PROPERTY(qreal extraLong2 READ extraLong2 CONSTANT FINAL)
51 Q_PROPERTY(qreal extraLong3 READ extraLong3 CONSTANT FINAL)
52 Q_PROPERTY(qreal extraLong4 READ extraLong4 CONSTANT FINAL)
53 Q_PROPERTY(qreal long1 READ long1 CONSTANT FINAL)
54 Q_PROPERTY(qreal long2 READ long2 CONSTANT FINAL)
55 Q_PROPERTY(qreal long3 READ long3 CONSTANT FINAL)
56 Q_PROPERTY(qreal long4 READ long4 CONSTANT FINAL)
57 Q_PROPERTY(qreal medium1 READ medium1 CONSTANT FINAL)
58 Q_PROPERTY(qreal medium2 READ medium2 CONSTANT FINAL)
59 Q_PROPERTY(qreal medium3 READ medium3 CONSTANT FINAL)
60 Q_PROPERTY(qreal medium4 READ medium4 CONSTANT FINAL)
61 Q_PROPERTY(qreal short1 READ short1 CONSTANT FINAL)
62 Q_PROPERTY(qreal short2 READ short2 CONSTANT FINAL)
63 Q_PROPERTY(qreal short3 READ short3 CONSTANT FINAL)
64 Q_PROPERTY(qreal short4 READ short4 CONSTANT FINAL)
65
66public:
67 constexpr qreal extraLong1() const
68 {
69 return 700.0;
70 }
71 constexpr qreal extraLong2() const
72 {
73 return 800.0;
74 }
75 constexpr qreal extraLong3() const
76 {
77 return 900.0;
78 }
79 constexpr qreal extraLong4() const
80 {
81 return 1000.0;
82 }
83 constexpr qreal long1() const
84 {
85 return 450.0;
86 }
87 constexpr qreal long2() const
88 {
89 return 500.0;
90 }
91 constexpr qreal long3() const
92 {
93 return 550.0;
94 }
95 constexpr qreal long4() const
96 {
97 return 600.0;
98 }
99 constexpr qreal medium1() const
100 {
101 return 250.0;
102 }
103 constexpr qreal medium2() const
104 {
105 return 300.0;
106 }
107 constexpr qreal medium3() const
108 {
109 return 350.0;
110 }
111 constexpr qreal medium4() const
112 {
113 return 400.0;
114 }
115 constexpr qreal short1() const
116 {
117 return 50.0;
118 }
119 constexpr qreal short2() const
120 {
121 return 100.0;
122 }
123 constexpr qreal short3() const
124 {
125 return 150.0;
126 }
127 constexpr qreal short4() const
128 {
129 return 200.0;
130 }
131};
132
142{
143 Q_GADGET
144 QML_ANONYMOUS
145
146 Q_PROPERTY(Fluid::MotionEasingValue emphasized READ emphasized CONSTANT FINAL)
149 Q_PROPERTY(Fluid::MotionEasingValue legacy READ legacy CONSTANT FINAL)
152 Q_PROPERTY(Fluid::MotionEasingValue linear READ linear CONSTANT FINAL)
153 Q_PROPERTY(Fluid::MotionEasingValue standard READ standard CONSTANT FINAL)
156
157public:
159 {
160 return { 0.2, 0.0, 0.0, 1.0 };
161 }
163 {
164 return { 0.3, 0.0, 0.8, 0.15 };
165 }
167 {
168 return { 0.05, 0.7, 0.1, 1.0 };
169 }
170 constexpr MotionEasingValue legacy() const
171 {
172 return { 0.4, 0.0, 0.2, 1.0 };
173 }
175 {
176 return { 0.4, 0.0, 1.0, 1.0 };
177 }
179 {
180 return { 0.0, 0.0, 0.2, 1.0 };
181 }
182 constexpr MotionEasingValue linear() const
183 {
184 return { 0.0, 0.0, 1.0, 1.0 };
185 }
186 constexpr MotionEasingValue standard() const
187 {
188 return { 0.2, 0.0, 0.0, 1.0 };
189 }
191 {
192 return { 0.3, 0.0, 1.0, 1.0 };
193 }
195 {
196 return { 0.0, 0.0, 0.0, 1.0 };
197 }
198};
199
201{
202 Q_GADGET
203 QML_ANONYMOUS
204
205 Q_PROPERTY(qreal damping MEMBER damping CONSTANT FINAL)
206 Q_PROPERTY(qreal stiffness MEMBER stiffness CONSTANT FINAL)
207
208public:
209 constexpr MotionSpringValue(qreal damping = 1.0, qreal stiffness = 0.0)
212 {
213 }
214
215 qreal damping;
216 qreal stiffness;
217};
218
228{
229 Q_GADGET
230 QML_ANONYMOUS
231
233 FINAL)
237 FINAL)
241 CONSTANT FINAL)
243 FINAL)
245 FINAL)
247 CONSTANT FINAL)
249 FINAL)
251 FINAL)
252
253public:
255 {
256 return { 0.9, 700.0 };
257 }
259 {
260 return { 0.9, 1400.0 };
261 }
263 {
264 return { 0.9, 300.0 };
265 }
267 {
268 return { 1.0, 1600.0 };
269 }
271 {
272 return { 1.0, 3800.0 };
273 }
275 {
276 return { 1.0, 800.0 };
277 }
279 {
280 return { 0.8, 380.0 };
281 }
283 {
284 return { 0.6, 800.0 };
285 }
287 {
288 return { 0.8, 200.0 };
289 }
291 {
292 return { 1.0, 1600.0 };
293 }
295 {
296 return { 1.0, 3800.0 };
297 }
299 {
300 return { 1.0, 800.0 };
301 }
302};
303
313{
314 Q_GADGET
315 QML_ANONYMOUS
316
317 Q_PROPERTY(Fluid::MotionDurationTokens duration READ duration CONSTANT FINAL)
318 Q_PROPERTY(Fluid::MotionEasingTokens easing READ easing CONSTANT FINAL)
319 Q_PROPERTY(Fluid::MotionSpringTokens spring READ spring CONSTANT FINAL)
320
321public:
323 {
324 return { };
325 }
326 constexpr MotionEasingTokens easing() const
327 {
328 return { };
329 }
330 constexpr MotionSpringTokens spring() const
331 {
332 return { };
333 }
334};
335
336} // namespace Fluid
Material Design 3 duration tokens.
constexpr qreal long3() const
constexpr qreal medium4() const
QML_ANONYMOUSqreal extraLong1
constexpr qreal medium2() const
constexpr qreal long1() const
constexpr qreal long4() const
constexpr qreal medium1() const
constexpr qreal short4() const
constexpr qreal extraLong2() const
constexpr qreal long2() const
constexpr qreal short2() const
constexpr qreal short1() const
constexpr qreal extraLong4() const
constexpr qreal short3() const
constexpr qreal extraLong3() const
constexpr qreal medium3() const
Material Design 3 cubic Bezier easing tokens.
constexpr MotionEasingValue standardDecelerate() const
Fluid::MotionEasingValue legacyAccelerate
constexpr MotionEasingValue legacyAccelerate() const
constexpr MotionEasingValue linear() const
Fluid::MotionEasingValue standardDecelerate
constexpr MotionEasingValue standard() const
Fluid::MotionEasingValue emphasizedAccelerate
constexpr MotionEasingValue legacy() const
constexpr MotionEasingValue emphasizedDecelerate() const
constexpr MotionEasingValue legacyDecelerate() const
Fluid::MotionEasingValue legacyDecelerate
constexpr MotionEasingValue emphasizedAccelerate() const
Fluid::MotionEasingValue standard
Fluid::MotionEasingValue standardAccelerate
constexpr MotionEasingValue standardAccelerate() const
Fluid::MotionEasingValue legacy
Fluid::MotionEasingValue emphasizedDecelerate
Fluid::MotionEasingValue linear
QML_ANONYMOUSFluid::MotionEasingValue emphasized
QML_ANONYMOUSqreal x1
Material Design 3 standard and expressive spring tokens.
constexpr MotionSpringValue standardSlowSpatial() const
constexpr MotionSpringValue expressiveDefaultEffects() const
constexpr MotionSpringValue standardFastSpatial() const
Fluid::MotionSpringValue expressiveSlowEffects
constexpr MotionSpringValue expressiveFastEffects() const
Fluid::MotionSpringValue expressiveSlowSpatial
constexpr MotionSpringValue expressiveSlowSpatial() const
constexpr MotionSpringValue expressiveFastSpatial() const
Fluid::MotionSpringValue standardFastEffects
Fluid::MotionSpringValue expressiveDefaultEffects
constexpr MotionSpringValue expressiveSlowEffects() const
Fluid::MotionSpringValue expressiveFastEffects
Fluid::MotionSpringValue standardDefaultEffects
Fluid::MotionSpringValue expressiveFastSpatial
constexpr MotionSpringValue standardFastEffects() const
constexpr MotionSpringValue standardSlowEffects() const
constexpr MotionSpringValue expressiveDefaultSpatial() const
Fluid::MotionSpringValue standardSlowEffects
Fluid::MotionSpringValue standardFastSpatial
Fluid::MotionSpringValue expressiveDefaultSpatial
QML_ANONYMOUSFluid::MotionSpringValue standardDefaultSpatial
Fluid::MotionSpringValue standardSlowSpatial
constexpr MotionSpringValue standardDefaultEffects() const
QML_ANONYMOUSqreal damping
Material Design 3 system motion tokens.
constexpr MotionEasingTokens easing() const
constexpr MotionSpringTokens spring() const
QML_ANONYMOUSFluid::MotionDurationTokens duration
Fluid::MotionEasingTokens easing
Fluid::MotionSpringTokens spring