@alea-design/motion 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +336 -0
- package/dist/index.js.map +1 -0
- package/dist/react.d.ts +211 -0
- package/package.json +56 -4
- package/src/motion.css +285 -0
- package/src/patterns.css +144 -0
- package/src/utilities.css +70 -0
package/src/patterns.css
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/* Alea Motion: more patterns. Each answers "what changed?"; the React helpers in
|
|
2
|
+
@alea-design/motion (TextSwap, NumberRoll, Presence, AutoHeight, ScrollProgress,
|
|
3
|
+
StreamingText, useRipple, HoldButton in @alea-design/ui) set the classes, and any
|
|
4
|
+
stack can set them by hand.
|
|
5
|
+
|
|
6
|
+
swap text or an icon changes with a short blur crossfade Save -> Saved, status text, plan names
|
|
7
|
+
roll digits roll to the new number prices, counters, stats, cart count
|
|
8
|
+
badge a count or dot appears with a spring notification badge, cart badge
|
|
9
|
+
success the busy state turns into a check, then back submit, save, copy buttons
|
|
10
|
+
dissolve removed things blur, shrink and fade tags, rows, files, cleared search
|
|
11
|
+
resize size changes animate instead of jumping cards that grow, panels, autosize fields
|
|
12
|
+
fan overlapping items spread on hover avatar group, card stacks
|
|
13
|
+
ripple press feedback grows from the pointer buttons with ripple, rows on touch
|
|
14
|
+
hold holding fills a bar, then confirms destructive actions
|
|
15
|
+
hint an arrow or icon nudges toward where it goes on hover "Learn more" links, next buttons
|
|
16
|
+
scroll scroll-linked progress, a header that hides on scroll reading progress, navbar
|
|
17
|
+
stream streamed text fades in by chunk; a shimmer while thinking AI answers, generation
|
|
18
|
+
route page changes crossfade, slide or zoom (View Transitions) router pages, master to detail */
|
|
19
|
+
|
|
20
|
+
@property --alea-hold { syntax: '<number>'; inherits: true; initial-value: 0; }
|
|
21
|
+
|
|
22
|
+
/* ------------------------------------------------------------------ swap */
|
|
23
|
+
.alea-swap { display: inline-grid; vertical-align: bottom; }
|
|
24
|
+
.alea-swap > * { grid-area: 1 / 1; }
|
|
25
|
+
.alea-swap-in { animation: alea-swap-in var(--alea-motion-duration-base) var(--alea-motion-ease-out) both; }
|
|
26
|
+
.alea-swap-out { animation: alea-swap-out var(--alea-motion-duration-fast) var(--alea-motion-ease-in) both; pointer-events: none; }
|
|
27
|
+
@keyframes alea-swap-in { from { opacity: 0.01; filter: blur(var(--alea-motion-blur-sm)); transform: translateY(calc(var(--alea-motion-distance-sm) * var(--alea-swap-dir, 1))); } }
|
|
28
|
+
@keyframes alea-swap-out { to { opacity: 0.01; filter: blur(var(--alea-motion-blur-sm)); transform: translateY(calc(var(--alea-motion-distance-sm) * var(--alea-swap-dir, 1) * -1)); } }
|
|
29
|
+
|
|
30
|
+
/* ------------------------------------------------------------------ roll */
|
|
31
|
+
.alea-roll { display: inline-flex; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
|
32
|
+
.alea-roll-digit { display: inline-block; height: 1lh; overflow: hidden; }
|
|
33
|
+
.alea-roll-strip { display: flex; flex-direction: column; transform: translateY(calc(var(--alea-roll-n, 0) * -1lh)); transition: transform var(--alea-motion-duration-slow) var(--alea-motion-ease-emphasized); }
|
|
34
|
+
.alea-roll-strip > span { height: 1lh; }
|
|
35
|
+
|
|
36
|
+
/* ------------------------------------------------------------------ badge */
|
|
37
|
+
.alea-badge-pop { display: inline-block; animation: alea-badge-pop var(--alea-motion-duration-base) var(--alea-motion-ease-emphasized); }
|
|
38
|
+
@keyframes alea-badge-pop { 0% { transform: scale(calc(1 - (1 - var(--alea-motion-scale-from)) * 10)); opacity: 0.01; } 70% { transform: scale(calc(1 + (1 - var(--alea-motion-scale-from)) * 4)); opacity: 1; } 100% { transform: none; } }
|
|
39
|
+
|
|
40
|
+
/* ------------------------------------------------------------------ success */
|
|
41
|
+
.alea-success-check path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: alea-draw-line var(--alea-motion-duration-slow) var(--alea-motion-ease-out) var(--alea-motion-duration-fast) forwards; }
|
|
42
|
+
.alea-success-in { animation: alea-badge-pop var(--alea-motion-duration-base) var(--alea-motion-ease-emphasized); }
|
|
43
|
+
@keyframes alea-draw-line { to { stroke-dashoffset: 0; } }
|
|
44
|
+
|
|
45
|
+
/* ------------------------------------------------------------------ dissolve */
|
|
46
|
+
.alea-dissolve-out { animation: alea-dissolve-out var(--alea-motion-duration-base) var(--alea-motion-ease-in) forwards; pointer-events: none; }
|
|
47
|
+
@keyframes alea-dissolve-out { to { opacity: 0.01; filter: blur(var(--alea-motion-blur-md)); transform: scale(calc(1 - (1 - var(--alea-motion-scale-from)) * 2)); } }
|
|
48
|
+
|
|
49
|
+
/* ------------------------------------------------------------------ resize */
|
|
50
|
+
.alea-autoheight { overflow: clip; transition: height var(--alea-motion-duration-base) var(--alea-motion-ease-out); }
|
|
51
|
+
|
|
52
|
+
/* ------------------------------------------------------------------ fan */
|
|
53
|
+
.alea-avatar-group[data-fan]:is(:hover, :focus-within) .alea-avatar + .alea-avatar { margin-inline-start: calc(var(--alea-motion-distance-sm) * 0.5); }
|
|
54
|
+
|
|
55
|
+
/* ------------------------------------------------------------------ ripple */
|
|
56
|
+
.alea-ripple-host { position: relative; overflow: hidden; isolation: isolate; }
|
|
57
|
+
.alea-ripple { position: absolute; z-index: -1; left: var(--alea-ripple-x); top: var(--alea-ripple-y); width: var(--alea-ripple-size); height: var(--alea-ripple-size); margin: calc(var(--alea-ripple-size) / -2) 0 0 calc(var(--alea-ripple-size) / -2); border-radius: 50%; background: currentColor; opacity: 0.18; pointer-events: none; animation: alea-ripple var(--alea-motion-duration-slower) var(--alea-motion-ease-out) forwards; }
|
|
58
|
+
@keyframes alea-ripple { from { transform: scale(0.1); opacity: 0.24; } to { transform: scale(1); opacity: 0.01; } }
|
|
59
|
+
|
|
60
|
+
/* ------------------------------------------------------------------ hold */
|
|
61
|
+
.alea-hold { position: relative; overflow: hidden; isolation: isolate; }
|
|
62
|
+
.alea-hold::before { content: ''; position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, currentColor 22%, transparent); transform-origin: left; transform: scaleX(var(--alea-hold)); }
|
|
63
|
+
.alea-hold[data-holding] { animation: alea-hold var(--alea-hold-duration, 1200ms) linear forwards; }
|
|
64
|
+
.alea-hold:not([data-holding]) { transition: --alea-hold var(--alea-motion-duration-base) var(--alea-motion-ease-out); }
|
|
65
|
+
@keyframes alea-hold { from { --alea-hold: 0; } to { --alea-hold: 1; } }
|
|
66
|
+
|
|
67
|
+
/* ------------------------------------------------------------------ hint */
|
|
68
|
+
.alea-hint-icon, .alea-hint > svg:last-child, .alea-link[data-variant='standalone'] > svg:last-child { transition: transform var(--alea-motion-duration-base) var(--alea-motion-ease-emphasized); }
|
|
69
|
+
:is(.alea-hint, .alea-link[data-variant='standalone']):is(:hover, :focus-visible) :is(.alea-hint-icon, svg:last-child) { transform: translateX(var(--alea-hint-distance, 3px)); }
|
|
70
|
+
@media (prefers-reduced-motion: reduce) { :root:not([data-alea-reduced='never']) { --alea-hint-distance: 0px; } }
|
|
71
|
+
|
|
72
|
+
/* ------------------------------------------------------------------ scroll */
|
|
73
|
+
.alea-scroll-progress { position: fixed; inset: 0 0 auto; z-index: 60; height: 4px; background: var(--alea-gradient-accent-linear); transform-origin: left; transform: scaleX(var(--alea-scroll, 0)); pointer-events: none; }
|
|
74
|
+
@supports (animation-timeline: scroll()) {
|
|
75
|
+
.alea-scroll-progress[data-css] { animation: alea-scroll-progress linear both; animation-timeline: scroll(root); }
|
|
76
|
+
@keyframes alea-scroll-progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
|
|
77
|
+
}
|
|
78
|
+
.alea-navbar { transition: transform var(--alea-motion-duration-base) var(--alea-motion-ease-out); }
|
|
79
|
+
.alea-navbar[data-scroll-hidden] { transform: translateY(-100%); }
|
|
80
|
+
|
|
81
|
+
/* ------------------------------------------------------------------ stream */
|
|
82
|
+
.alea-stream-chunk { animation: alea-stream-in var(--alea-motion-duration-slow) var(--alea-motion-ease-out) both; }
|
|
83
|
+
@keyframes alea-stream-in { from { opacity: 0.01; filter: blur(var(--alea-motion-blur-sm)); } }
|
|
84
|
+
.alea-stream[data-streaming]::after { content: ''; display: inline-block; width: 0.5em; height: 1em; margin-left: var(--alea-space-0-5, 2px); vertical-align: -0.12em; border-radius: var(--alea-radius-2xs, 2px); background: currentColor; animation: alea-caret 1s steps(2, start) infinite; }
|
|
85
|
+
@keyframes alea-caret { to { visibility: hidden; } }
|
|
86
|
+
.alea-text-shimmer { background: linear-gradient(90deg, var(--alea-text-muted) 0%, var(--alea-text-muted) 40%, var(--alea-text) 50%, var(--alea-text-muted) 60%, var(--alea-text-muted) 100%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: alea-text-shimmer 2s linear infinite; }
|
|
87
|
+
@keyframes alea-text-shimmer { from { background-position: 125% 0; } to { background-position: -125% 0; } }
|
|
88
|
+
@media (prefers-reduced-motion: reduce) {
|
|
89
|
+
:root:not([data-alea-reduced='never']) :is(.alea-text-shimmer, .alea-stream[data-streaming]::after) { animation: none; }
|
|
90
|
+
:root:not([data-alea-reduced='never']) .alea-text-shimmer { color: var(--alea-text-muted); background: none; }
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* ------------------------------------------------------------------ route (View Transitions API: document.startViewTransition, React Router's viewTransition) */
|
|
94
|
+
::view-transition-old(root) { animation: var(--alea-motion-duration-fast) var(--alea-motion-ease-in) both alea-m-fade-out; }
|
|
95
|
+
::view-transition-new(root) { animation: var(--alea-motion-duration-base) var(--alea-motion-ease-out) both alea-m-fade-in; }
|
|
96
|
+
[data-route-motion='slide']::view-transition-old(root) { animation: var(--alea-motion-duration-fast) var(--alea-motion-ease-in) both alea-route-out; }
|
|
97
|
+
[data-route-motion='slide']::view-transition-new(root) { animation: var(--alea-motion-duration-base) var(--alea-motion-ease-out) both alea-route-in; }
|
|
98
|
+
[data-route-motion='zoom']::view-transition-new(root) { animation: var(--alea-motion-duration-base) var(--alea-motion-ease-out) both alea-m-scale-in; }
|
|
99
|
+
[data-route-motion='none']::view-transition-old(root), [data-route-motion='none']::view-transition-new(root) { animation: none; }
|
|
100
|
+
@keyframes alea-route-in { from { opacity: 0.01; transform: translateX(calc(var(--alea-motion-distance-lg) * 2)); } }
|
|
101
|
+
@keyframes alea-route-out { to { opacity: 0.01; transform: translateX(calc(var(--alea-motion-distance-lg) * -2)); } }
|
|
102
|
+
:is([data-alea-motion='reduced'], [data-alea-reduced='always']) { --alea-hint-distance: 0px; }
|
|
103
|
+
:is([data-alea-motion='reduced'], [data-alea-reduced='always']) :is(.alea-text-shimmer, .alea-stream[data-streaming]::after) { animation: none; }
|
|
104
|
+
:is([data-alea-motion='reduced'], [data-alea-reduced='always']) .alea-text-shimmer { color: var(--alea-text-muted); background: none; }
|
|
105
|
+
|
|
106
|
+
/* ------------------------------------------------------------------ more patterns */
|
|
107
|
+
/* check draws itself (Checkbox paths have pathLength 1) */
|
|
108
|
+
.alea-check-box path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset var(--alea-motion-duration-base) var(--alea-motion-ease-out) var(--alea-motion-duration-instant); }
|
|
109
|
+
.alea-check[data-selected] .alea-check-box path, .alea-check[data-indeterminate] .alea-check-box path { stroke-dashoffset: 0; }
|
|
110
|
+
/* success: the check comes in turning, with a blur */
|
|
111
|
+
.alea-success-in { animation: alea-success-in var(--alea-motion-duration-slow) var(--alea-motion-spring) both; }
|
|
112
|
+
@keyframes alea-success-in { from { opacity: 0.01; filter: blur(var(--alea-motion-blur-sm)); transform: scale(calc(1 - (1 - var(--alea-motion-scale-from)) * 5)) rotate(calc(var(--alea-motion-rotate, 12deg) * -2.5)); } }
|
|
113
|
+
/* swap, scale variant: for icons */
|
|
114
|
+
.alea-swap[data-variant='scale'] .alea-swap-in { animation-name: alea-swap-scale-in; animation-timing-function: var(--alea-motion-spring); }
|
|
115
|
+
.alea-swap[data-variant='scale'] .alea-swap-out { animation-name: alea-swap-scale-out; }
|
|
116
|
+
@keyframes alea-swap-scale-in { from { opacity: 0.01; filter: blur(var(--alea-motion-blur-sm)); transform: scale(calc(1 - (1 - var(--alea-motion-scale-from)) * 6)); } }
|
|
117
|
+
@keyframes alea-swap-scale-out { to { opacity: 0.01; filter: blur(var(--alea-motion-blur-sm)); transform: scale(calc(1 - (1 - var(--alea-motion-scale-from)) * 6)); } }
|
|
118
|
+
/* dissolve: cleared words leave one after another */
|
|
119
|
+
.alea-input-ghost { position: absolute; left: var(--alea-input-ghost-left, var(--alea-space-10, 40px)); top: 50%; translate: 0 -50%; display: flex; white-space: pre; pointer-events: none; color: var(--alea-text); font: inherit; }
|
|
120
|
+
.alea-input-ghost > span { display: inline-block; animation: alea-dissolve-out var(--alea-motion-duration-slow) var(--alea-motion-ease-in) both; animation-delay: calc(var(--alea-i, 0) * var(--alea-motion-stagger)); }
|
|
121
|
+
/* skeleton to content */
|
|
122
|
+
.alea-skeleton-reveal { display: contents; }
|
|
123
|
+
.alea-skeleton-reveal > * { animation: alea-m-blur-in var(--alea-motion-duration-slow) var(--alea-motion-ease-out) both; }
|
|
124
|
+
/* fan with falloff: the hovered avatar lifts most, its neighbours less, and they bounce back */
|
|
125
|
+
.alea-avatar-group[data-fan] .alea-avatar { transition: margin var(--alea-motion-duration-base) var(--alea-motion-ease-emphasized), translate var(--alea-motion-duration-slow) var(--alea-motion-spring); }
|
|
126
|
+
.alea-avatar-group[data-fan] .alea-avatar:hover { translate: 0 calc(var(--alea-motion-lift) * 2); }
|
|
127
|
+
.alea-avatar-group[data-fan] .alea-avatar:hover + .alea-avatar, .alea-avatar-group[data-fan] .alea-avatar:has(+ .alea-avatar:hover) { translate: 0 var(--alea-motion-lift); }
|
|
128
|
+
.alea-avatar-group[data-fan] .alea-avatar:hover + .alea-avatar + .alea-avatar, .alea-avatar-group[data-fan] .alea-avatar:has(+ .alea-avatar + .alea-avatar:hover) { translate: 0 calc(var(--alea-motion-lift) * 0.4); }
|
|
129
|
+
/* drop zones lean in when something is dragged over them; the border marches */
|
|
130
|
+
.alea-dropzone { transition: transform var(--alea-motion-duration-base) var(--alea-motion-spring), background-color var(--alea-motion-duration-fast) var(--alea-motion-ease-standard), border-color var(--alea-motion-duration-fast) var(--alea-motion-ease-standard); }
|
|
131
|
+
.alea-dropzone[data-drop-target] { transform: scale(calc(1 + (1 - var(--alea-motion-scale-press)) * 0.5)); }
|
|
132
|
+
/* dot loader: a 4 × 4 matrix that pulses in a diagonal wave */
|
|
133
|
+
.alea-dot-loader { display: inline-grid; grid-template-columns: repeat(4, 1fr); gap: var(--alea-space-0-5, 2px); width: 24px; height: 24px; }
|
|
134
|
+
.alea-dot-loader[data-size='sm'] { width: 16px; height: 16px; gap: var(--alea-space-0-25, 1px); }
|
|
135
|
+
.alea-dot-loader[data-size='lg'] { width: 40px; height: 40px; gap: var(--alea-space-1, 4px); }
|
|
136
|
+
.alea-dot-loader i { border-radius: 50%; background: var(--alea-accent); animation: alea-dot 1.2s var(--alea-motion-ease-in-out) infinite both; animation-delay: calc(var(--alea-dot-d, 0) * 90ms); }
|
|
137
|
+
@keyframes alea-dot { 0%, 100% { opacity: 0.2; transform: scale(0.6); } 40% { opacity: 1; transform: none; } }
|
|
138
|
+
|
|
139
|
+
/* ------------------------------------------------------------------ morph icon: one turns and grows in, the other blurs out */
|
|
140
|
+
.alea-morph-icon { position: relative; display: inline-grid; place-items: center; }
|
|
141
|
+
.alea-morph-icon > span { grid-area: 1 / 1; display: inline-flex; transition: opacity var(--alea-motion-duration-base) var(--alea-motion-ease-out), transform var(--alea-motion-duration-base) var(--alea-motion-spring, var(--alea-motion-ease-out)), filter var(--alea-motion-duration-base) var(--alea-motion-ease-out); }
|
|
142
|
+
.alea-morph-icon-b { opacity: 0; transform: rotate(calc(var(--alea-motion-rotate, 12deg) * -7.5)) scale(calc(1 - (1 - var(--alea-motion-scale-from)) * 6)); filter: blur(var(--alea-motion-blur-sm)); }
|
|
143
|
+
.alea-morph-icon[data-active] .alea-morph-icon-a { opacity: 0; transform: rotate(calc(var(--alea-motion-rotate, 12deg) * 7.5)) scale(calc(1 - (1 - var(--alea-motion-scale-from)) * 6)); filter: blur(var(--alea-motion-blur-sm)); }
|
|
144
|
+
.alea-morph-icon[data-active] .alea-morph-icon-b { opacity: 1; transform: none; filter: none; }
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* Alea Motion utilities: motion for your own elements, from the same tokens.
|
|
2
|
+
|
|
3
|
+
Enter on mount <div class="alea-enter" data-motion="rise"> (any preset; default fade)
|
|
4
|
+
Enter on scroll <Reveal motion="rise"> or data-reveal="pending|in" set by your own observer
|
|
5
|
+
Stagger children <ul data-stagger> ... </ul> (each child waits --alea-motion-stagger more)
|
|
6
|
+
Delay style="--alea-enter-delay: 120ms"
|
|
7
|
+
Hover and press alea-hover-lift, alea-hover-scale, alea-hover-glow, alea-hover-tint, alea-press, alea-hint */
|
|
8
|
+
|
|
9
|
+
/* ------------------------------------------------------------------ enter on mount and on reveal */
|
|
10
|
+
.alea-enter, [data-reveal='in'] { animation: var(--alea-enter-duration, var(--alea-motion-duration-slow)) var(--alea-enter-ease, var(--alea-motion-ease-out)) var(--alea-enter-delay, 0s) both var(--alea-enter, alea-m-fade-in); }
|
|
11
|
+
/* waiting off screen: fully transparent (the entrance itself starts at 0.01) */
|
|
12
|
+
[data-reveal='pending'] { opacity: 0; }
|
|
13
|
+
|
|
14
|
+
/* ------------------------------------------------------------------ stagger: children enter one after another (first 12) */
|
|
15
|
+
[data-stagger] > * { animation: var(--alea-motion-duration-slow) var(--alea-motion-ease-out) both alea-item-in; animation-delay: calc(var(--alea-i, 0) * var(--alea-motion-stagger)); }
|
|
16
|
+
[data-stagger='reveal'] > * { animation-name: alea-m-rise-in; }
|
|
17
|
+
[data-stagger] > :nth-child(2) { --alea-i: 1; } [data-stagger] > :nth-child(3) { --alea-i: 2; } [data-stagger] > :nth-child(4) { --alea-i: 3; }
|
|
18
|
+
[data-stagger] > :nth-child(5) { --alea-i: 4; } [data-stagger] > :nth-child(6) { --alea-i: 5; } [data-stagger] > :nth-child(7) { --alea-i: 6; }
|
|
19
|
+
[data-stagger] > :nth-child(8) { --alea-i: 7; } [data-stagger] > :nth-child(9) { --alea-i: 8; } [data-stagger] > :nth-child(10) { --alea-i: 9; }
|
|
20
|
+
[data-stagger] > :nth-child(11) { --alea-i: 10; } [data-stagger] > :nth-child(n+12) { --alea-i: 11; }
|
|
21
|
+
[data-stagger][data-reveal='pending'] { opacity: 1; }
|
|
22
|
+
[data-stagger][data-reveal='pending'] > * { animation: none; opacity: 0; }
|
|
23
|
+
|
|
24
|
+
/* ------------------------------------------------------------------ hover and press */
|
|
25
|
+
:is(.alea-hover-lift, .alea-hover-scale, .alea-hover-glow, .alea-hover-tint, .alea-press) {
|
|
26
|
+
transition: transform var(--alea-motion-duration-base) var(--alea-motion-ease-out), box-shadow var(--alea-motion-duration-base) var(--alea-motion-ease-out), background-color var(--alea-motion-duration-fast) var(--alea-motion-ease-standard);
|
|
27
|
+
}
|
|
28
|
+
.alea-hover-lift:hover { transform: translateY(var(--alea-motion-lift)); box-shadow: var(--alea-shadow-pop); }
|
|
29
|
+
.alea-hover-scale:hover { transform: scale(calc(2 - var(--alea-motion-scale-press))); }
|
|
30
|
+
.alea-hover-glow:hover { box-shadow: 0 0 0 1px color-mix(in srgb, var(--alea-accent) 45%, transparent), 0 8px 32px -8px color-mix(in srgb, var(--alea-accent) 55%, transparent); }
|
|
31
|
+
.alea-hover-tint:hover { background-color: var(--alea-surface-hover); }
|
|
32
|
+
.alea-press:active { transform: scale(var(--alea-motion-scale-press)); transition-duration: var(--alea-motion-duration-instant); }
|
|
33
|
+
|
|
34
|
+
/* ------------------------------------------------------------------ any pattern on any element
|
|
35
|
+
<span class="alea-m" data-m="pop">…</span> plays once when it mounts
|
|
36
|
+
data-m-on="hover | press | focus | visible | change | loop" when it plays instead
|
|
37
|
+
visible: set data-m-in when it scrolls in (Motion and useMotion do it); change: re-set data-m-run to replay
|
|
38
|
+
style="--alea-m-delay: 120ms; --alea-m-duration: 480ms" per element (defaults: the tokens)
|
|
39
|
+
Hover and press patterns are utilities: alea-hover-lift, alea-press, alea-hover-tint, alea-hover-glow, alea-hint.
|
|
40
|
+
With reduced motion the entrances only fade (the distances and scales are tokens) and loops stop. */
|
|
41
|
+
.alea-m {
|
|
42
|
+
--alea-m-name: alea-m-fade-in;
|
|
43
|
+
animation-duration: var(--alea-m-duration, var(--alea-motion-duration-slow));
|
|
44
|
+
animation-timing-function: var(--alea-m-ease, var(--alea-motion-ease-out));
|
|
45
|
+
animation-delay: var(--alea-m-delay, 0s);
|
|
46
|
+
animation-fill-mode: both;
|
|
47
|
+
transform-origin: var(--alea-m-origin, center);
|
|
48
|
+
}
|
|
49
|
+
.alea-m[data-m='pop'] { --alea-m-name: alea-m-pop-in; --alea-m-ease: var(--alea-motion-ease-emphasized); --alea-m-duration: var(--alea-motion-duration-base); }
|
|
50
|
+
.alea-m[data-m='rise'] { --alea-m-name: alea-m-rise-in; }
|
|
51
|
+
.alea-m[data-m='drop'] { --alea-m-name: alea-m-drop-in; }
|
|
52
|
+
.alea-m[data-m='scale'] { --alea-m-name: alea-m-scale-in; }
|
|
53
|
+
.alea-m[data-m='zoom'] { --alea-m-name: alea-m-zoom-in; }
|
|
54
|
+
.alea-m[data-m='blur'] { --alea-m-name: alea-m-blur-in; }
|
|
55
|
+
.alea-m[data-m='flip'] { --alea-m-name: alea-m-flip-in; }
|
|
56
|
+
.alea-m[data-m='slide-up'] { --alea-m-name: alea-m-slide-up-in; }
|
|
57
|
+
.alea-m[data-m='slide-down'] { --alea-m-name: alea-m-slide-down-in; }
|
|
58
|
+
.alea-m[data-m='slide-left'] { --alea-m-name: alea-m-slide-left-in; }
|
|
59
|
+
.alea-m[data-m='slide-right'] { --alea-m-name: alea-m-slide-right-in; }
|
|
60
|
+
.alea-m[data-m='badge'] { --alea-m-name: alea-badge-pop; --alea-m-ease: var(--alea-motion-ease-emphasized); --alea-m-duration: var(--alea-motion-duration-base); }
|
|
61
|
+
.alea-m[data-m='nudge'] { --alea-m-name: alea-nudge; --alea-m-ease: var(--alea-motion-ease-in-out); --alea-m-duration: var(--alea-motion-duration-slow); }
|
|
62
|
+
.alea-m[data-m='pulse'] { --alea-m-name: alea-m-pulse; --alea-m-ease: var(--alea-motion-ease-in-out); --alea-m-duration: 1.2s; }
|
|
63
|
+
.alea-m[data-m='draw'] { --alea-m-name: alea-m-draw; --alea-m-origin: left center; }
|
|
64
|
+
.alea-m:is(:not([data-m-on]), [data-m-on='mount'], [data-m-on='hover']:hover, [data-m-on='press']:active, [data-m-on='focus']:focus-visible, [data-m-on='focus']:has(:focus-visible), [data-m-on='visible'][data-m-in], [data-m-on='change'][data-m-run]) { animation-name: var(--alea-m-name); }
|
|
65
|
+
.alea-m[data-m-on='loop'] { animation-name: var(--alea-m-name); animation-iteration-count: infinite; animation-direction: alternate; }
|
|
66
|
+
@keyframes alea-m-pulse { from { transform: scale(1); } to { transform: scale(calc(2 - var(--alea-motion-scale-press))); } }
|
|
67
|
+
@keyframes alea-m-draw { from { transform: scaleX(0.01); } }
|
|
68
|
+
@media (prefers-reduced-motion: reduce) { :root:not([data-alea-reduced='never']) .alea-m[data-m-on='loop'] { animation: none; } }
|
|
69
|
+
:is([data-alea-motion='reduced'], [data-alea-reduced='always']) .alea-m[data-m-on='loop'] { animation: none; }
|
|
70
|
+
:is([data-alea-motion='off']) .alea-m { animation: none; }
|