motionary 9.9.0 → 10.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/CHANGELOG.md +41 -0
- package/README.md +45 -0
- package/bin/create-motionary-plugin.mjs +124 -0
- package/dist/chunks/{audio-C1uFaOKQ.js → audio-D95jwlOh.js} +3 -3
- package/dist/chunks/{audio-C1uFaOKQ.js.map → audio-D95jwlOh.js.map} +1 -1
- package/dist/chunks/{base-DWYNLg6P.js → base-BnRyfuyM.js} +2 -2
- package/dist/chunks/{base-DWYNLg6P.js.map → base-BnRyfuyM.js.map} +1 -1
- package/dist/chunks/{builtins-DoCY96r9.js → builtins-CqIq1zBv.js} +3 -3
- package/dist/chunks/{builtins-DoCY96r9.js.map → builtins-CqIq1zBv.js.map} +1 -1
- package/dist/chunks/{core-DoR4w-E4.js → core-DsGoL9EY.js} +2 -2
- package/dist/chunks/{core-DoR4w-E4.js.map → core-DsGoL9EY.js.map} +1 -1
- package/dist/chunks/{core-BhuojMcL.js → core-XA2yhn1b.js} +2 -2
- package/dist/chunks/{core-BhuojMcL.js.map → core-XA2yhn1b.js.map} +1 -1
- package/dist/chunks/{fx-XBDr7-dH.js → fx-CtnrFEg9.js} +2 -2
- package/dist/chunks/{fx-XBDr7-dH.js.map → fx-CtnrFEg9.js.map} +1 -1
- package/dist/chunks/{gpu-DvLHwLxy.js → gpu-CDcXiNA8.js} +2 -2
- package/dist/chunks/{gpu-DvLHwLxy.js.map → gpu-CDcXiNA8.js.map} +1 -1
- package/dist/chunks/keyframes-CyH_abhI.js +183 -0
- package/dist/chunks/keyframes-CyH_abhI.js.map +1 -0
- package/dist/chunks/keyframes-cUdsXSXQ.cjs +187 -0
- package/dist/chunks/keyframes-cUdsXSXQ.cjs.map +1 -0
- package/dist/chunks/{manifest-BDpbuI-9.js → manifest-D58HXVY-.js} +2 -2
- package/dist/chunks/{manifest-BDpbuI-9.js.map → manifest-D58HXVY-.js.map} +1 -1
- package/dist/chunks/{player-CYGvna09.js → player-48Zy_NBG.js} +4 -4
- package/dist/chunks/{player-CYGvna09.js.map → player-48Zy_NBG.js.map} +1 -1
- package/dist/chunks/registry-C0xLNq3-.cjs +81 -0
- package/dist/chunks/registry-C0xLNq3-.cjs.map +1 -0
- package/dist/chunks/{registry-BRM2BRRY.js → registry-gFJRpPES.js} +2 -2
- package/dist/chunks/{registry-BRM2BRRY.js.map → registry-gFJRpPES.js.map} +1 -1
- package/dist/chunks/registry-jF8VIA_9.js +69 -0
- package/dist/chunks/registry-jF8VIA_9.js.map +1 -0
- package/dist/chunks/{spring-CAlkc1co.js → spring-CZDNyqWp.js} +2 -2
- package/dist/chunks/{spring-CAlkc1co.js.map → spring-CZDNyqWp.js.map} +1 -1
- package/dist/chunks/tween-DDObu9iA.js +542 -0
- package/dist/chunks/tween-DDObu9iA.js.map +1 -0
- package/dist/chunks/tween-JEthWrjo.cjs +554 -0
- package/dist/chunks/tween-JEthWrjo.cjs.map +1 -0
- package/dist/chunks/{variants-BBfyVPYm.js → variants-GU3yIL4F.js} +2 -2
- package/dist/chunks/{variants-BBfyVPYm.js.map → variants-GU3yIL4F.js.map} +1 -1
- package/dist/components/a11y.js +2 -2
- package/dist/components/angular.js +8 -8
- package/dist/components/background.js +2 -2
- package/dist/components/bridge.js +1 -1
- package/dist/components/cards.js +2 -2
- package/dist/components/click.js +3 -3
- package/dist/components/core.cjs +219 -0
- package/dist/components/core.cjs.map +1 -0
- package/dist/components/core.d.cts +81 -0
- package/dist/components/core.d.ts +81 -0
- package/dist/components/core.js +214 -0
- package/dist/components/core.js.map +1 -0
- package/dist/components/depth.js +3 -3
- package/dist/components/design.js +3 -3
- package/dist/components/dsl.js +2 -2
- package/dist/components/effects.js +9 -9
- package/dist/components/engine.js +2 -2
- package/dist/components/feedback.js +1 -1
- package/dist/components/fx-3d.js +2 -2
- package/dist/components/fx-ai.js +2 -2
- package/dist/components/fx-chart.js +2 -2
- package/dist/components/fx-cinema.js +2 -2
- package/dist/components/fx-cyber.js +2 -2
- package/dist/components/fx-festival.js +2 -2
- package/dist/components/fx-focus.js +2 -2
- package/dist/components/fx-form.js +2 -2
- package/dist/components/fx-game.js +2 -2
- package/dist/components/fx-genart.js +2 -2
- package/dist/components/fx-geo.js +2 -2
- package/dist/components/fx-gesture.js +2 -2
- package/dist/components/fx-gpu.js +3 -3
- package/dist/components/fx-light.js +2 -2
- package/dist/components/fx-lottie.js +2 -2
- package/dist/components/fx-morph.js +2 -2
- package/dist/components/fx-music.js +3 -3
- package/dist/components/fx-organic.js +2 -2
- package/dist/components/fx-paper.js +2 -2
- package/dist/components/fx-perf.js +2 -2
- package/dist/components/fx-physics.js +2 -2
- package/dist/components/fx-retro.js +2 -2
- package/dist/components/fx-safe.js +2 -2
- package/dist/components/fx-shop.js +2 -2
- package/dist/components/fx-social.js +2 -2
- package/dist/components/fx-spatial.js +2 -2
- package/dist/components/fx-surface.js +2 -2
- package/dist/components/fx-text.js +2 -2
- package/dist/components/fx-transitions.js +3 -3
- package/dist/components/fx-video.js +2 -2
- package/dist/components/fx-weather.js +2 -2
- package/dist/components/fx.js +6 -6
- package/dist/components/fx2.cjs +1 -10
- package/dist/components/fx2.cjs.map +1 -1
- package/dist/components/fx2.d.cts +1 -6
- package/dist/components/fx2.d.ts +1 -6
- package/dist/components/fx2.js +7 -15
- package/dist/components/fx2.js.map +1 -1
- package/dist/components/gesture.js +4 -4
- package/dist/components/interaction.js +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/marketplace.cjs +104 -0
- package/dist/components/marketplace.cjs.map +1 -1
- package/dist/components/marketplace.d.cts +33 -2
- package/dist/components/marketplace.d.ts +33 -2
- package/dist/components/marketplace.js +105 -5
- package/dist/components/marketplace.js.map +1 -1
- package/dist/components/native.js +3 -3
- package/dist/components/packs.js +1 -1
- package/dist/components/page.js +3 -3
- package/dist/components/perf.js +2 -2
- package/dist/components/physics.js +3 -3
- package/dist/components/plugins.cjs +138 -0
- package/dist/components/plugins.cjs.map +1 -0
- package/dist/components/plugins.d.cts +120 -0
- package/dist/components/plugins.d.ts +120 -0
- package/dist/components/plugins.js +105 -0
- package/dist/components/plugins.js.map +1 -0
- package/dist/components/reveal.js +1 -1
- package/dist/components/solid.js +8 -8
- package/dist/components/svelte.js +8 -8
- package/dist/components/svg.js +1 -1
- package/dist/components/text.js +2 -2
- package/dist/components/timeline.js +3 -3
- package/dist/components/transitions.js +1 -1
- package/dist/components/ui.js +4 -4
- package/dist/components/vue.js +8 -8
- package/dist/components/webgl.js +1 -1
- package/dist/components/widgets.cjs +420 -199
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +42 -2
- package/dist/components/widgets.d.ts +42 -2
- package/dist/components/widgets.js +428 -209
- package/dist/components/widgets.js.map +1 -1
- package/dist/components.js +10 -10
- package/dist/index.js +2 -2
- package/dist/llms-full.txt +3018 -0
- package/dist/llms.txt +207 -0
- package/dist/manifest.json +7562 -0
- package/dist/manifest.schema.json +85 -0
- package/dist/runtime/format-css.cjs +184 -0
- package/dist/runtime/format-css.cjs.map +1 -0
- package/dist/runtime/format-css.d.cts +174 -0
- package/dist/runtime/format-css.d.ts +174 -0
- package/dist/runtime/format-css.iife.js +2 -0
- package/dist/runtime/format-css.iife.js.map +1 -0
- package/dist/runtime/format-css.js +176 -0
- package/dist/runtime/format-css.js.map +1 -0
- package/dist/runtime/format-motion.cjs +138 -0
- package/dist/runtime/format-motion.cjs.map +1 -0
- package/dist/runtime/format-motion.d.cts +208 -0
- package/dist/runtime/format-motion.d.ts +208 -0
- package/dist/runtime/format-motion.iife.js +2 -0
- package/dist/runtime/format-motion.iife.js.map +1 -0
- package/dist/runtime/format-motion.js +132 -0
- package/dist/runtime/format-motion.js.map +1 -0
- package/dist/runtime.cjs +78 -0
- package/dist/runtime.cjs.map +1 -0
- package/dist/runtime.d.cts +236 -0
- package/dist/runtime.d.ts +236 -0
- package/dist/runtime.iife.js +2 -0
- package/dist/runtime.iife.js.map +1 -0
- package/dist/runtime.js +54 -0
- package/dist/runtime.js.map +1 -0
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +85 -14
- package/docs/components.md +66 -0
- package/docs/core.md +47 -0
- package/docs/deprecations.md +1 -1
- package/docs/runtime/core.md +55 -0
- package/docs/runtime/format-css.md +59 -0
- package/docs/runtime/format-motion.md +56 -0
- package/docs/upgrading-10.md +1 -1
- package/package.json +88 -6
|
@@ -0,0 +1,3018 @@
|
|
|
1
|
+
# Motionary 10.1.0 — full component reference
|
|
2
|
+
|
|
3
|
+
Generated from the source. Machine-readable version: https://harrisoncn.github.io/Motionary/components.json (schema https://harrisoncn.github.io/Motionary/components.schema.json).
|
|
4
|
+
|
|
5
|
+
## Runtime modules
|
|
6
|
+
|
|
7
|
+
### motionary/runtime — Runtime core
|
|
8
|
+
|
|
9
|
+
Shared ticker (one rAF loop), tween + timeline engine with easing, module registry with clear errors.
|
|
10
|
+
|
|
11
|
+
- Install: `npm i motionary`
|
|
12
|
+
- Import: `motionary/runtime`
|
|
13
|
+
- Register: `use();` — Import motionary/runtime and call use() once at start-up, before any runtime-powered component mounts. CDN: the IIFE registers itself (window.MotionaryRuntime).
|
|
14
|
+
- CDN:
|
|
15
|
+
|
|
16
|
+
```html
|
|
17
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import { use, tween, timeline } from 'motionary/runtime';
|
|
22
|
+
use();
|
|
23
|
+
tween('.box', { to: { x: 120, opacity: 1 }, duration: 500, ease: 'back-out' });
|
|
24
|
+
timeline().to('.a', { to: { y: -20 } }).to('.b', { to: { scale: 1.2 } }, '<+=100');
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### motionary/runtime/format-css — CSS @keyframes & WAAPI keyframes loader
|
|
28
|
+
|
|
29
|
+
Import CSS @keyframes text or live CSSKeyframesRule objects and Web Animations API keyframes (array or property-indexed) into a runtime timeline.
|
|
30
|
+
|
|
31
|
+
- Install: `npm i motionary`
|
|
32
|
+
- Import: `motionary/runtime/format-css`
|
|
33
|
+
- Register: `use(formatCss);` — Register the core first, then the module: use(formatCss) also registers the core. CDN: load runtime.iife.js, then runtime/format-css.iife.js (it registers itself).
|
|
34
|
+
- CDN:
|
|
35
|
+
|
|
36
|
+
```html
|
|
37
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
|
|
38
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-css.iife.js"></script>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
import { use } from 'motionary/runtime';
|
|
43
|
+
import { formatCss, parseKeyframes, playKeyframes } from 'motionary/runtime/format-css';
|
|
44
|
+
use(formatCss);
|
|
45
|
+
const [pulse] = parseKeyframes('@keyframes pulse { from { opacity: .4 } 50% { opacity: 1; transform: scale(1.1) } to { opacity: .4 } }');
|
|
46
|
+
playKeyframes(document.querySelector('.dot'), pulse, { duration: 1200, repeat: -1 });
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### motionary/runtime/format-motion — Motion / Framer keyframe JSON loader
|
|
50
|
+
|
|
51
|
+
Play Motion / Framer-style { initial, animate, transition } JSON (arrays as keyframes, times, repeatType, springs) with the runtime.
|
|
52
|
+
|
|
53
|
+
- Install: `npm i motionary`
|
|
54
|
+
- Import: `motionary/runtime/format-motion`
|
|
55
|
+
- Register: `use(formatMotion);` — Register the core first, then the module: use(formatMotion) also registers the core. CDN: load runtime.iife.js, then runtime/format-motion.iife.js (it registers itself).
|
|
56
|
+
- CDN:
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
|
|
60
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-motion.iife.js"></script>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
import { use } from 'motionary/runtime';
|
|
65
|
+
import { formatMotion, playMotion } from 'motionary/runtime/format-motion';
|
|
66
|
+
use(formatMotion);
|
|
67
|
+
playMotion(document.querySelector('.card'), { initial: { opacity: 0, y: 40 }, animate: { opacity: 1, y: 0 }, transition: { type: 'spring', stiffness: 180, damping: 14 } });
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Components
|
|
71
|
+
|
|
72
|
+
### <usa-accordion> — Accordion
|
|
73
|
+
|
|
74
|
+
Smooth expand / collapse for native <details> — semantics, keyboard and find-in-page kept; no wrapper elements.
|
|
75
|
+
|
|
76
|
+
- Import: `import { defineAccordion } from 'motionary/components/transitions'; defineAccordion();`
|
|
77
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
78
|
+
- Events: `usa:toggle`
|
|
79
|
+
- Methods: `toggleItem()`
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<usa-accordion>
|
|
83
|
+
<details><summary>Shipping</summary><p>…</p></details>
|
|
84
|
+
<details><summary>Returns</summary><p>…</p></details>
|
|
85
|
+
</usa-accordion>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### <usa-acrylic> — Acrylic & Mica
|
|
89
|
+
|
|
90
|
+
Windows Fluent materials: frosted acrylic (backdrop blur + tint + noise) and mica. Solid fallback when transparency is reduced.
|
|
91
|
+
|
|
92
|
+
- Import: `import { defineAcrylic } from 'motionary/components/background'; defineAcrylic();`
|
|
93
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
94
|
+
- Attributes: `tint`, `tint-opacity`, `blur`, `shimmer`
|
|
95
|
+
|
|
96
|
+
```html
|
|
97
|
+
<usa-acrylic shimmer="hover">
|
|
98
|
+
<nav>…</nav>
|
|
99
|
+
</usa-acrylic>
|
|
100
|
+
<usa-acrylic kind="mica">…</usa-acrylic>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### <usa-add-to-cart> — Add to cart (fly-to-cart)
|
|
104
|
+
|
|
105
|
+
7.3: a buy button — the product photo flies on an arc into the cart, the cart badge bumps and the button morphs into a ✓ “Added” state. Works with <usa-cart-drawer> (calls add(item)) or any [data-cart] icon.
|
|
106
|
+
|
|
107
|
+
- Import: `import { defineAddToCart } from 'motionary/components/widgets'; defineAddToCart();`
|
|
108
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
109
|
+
- Events: `usa:add`
|
|
110
|
+
- Methods: `add()`
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
<usa-cart-drawer id="cart"></usa-cart-drawer>
|
|
114
|
+
<div data-product>
|
|
115
|
+
<img src="shoe.jpg" alt="Sneaker">
|
|
116
|
+
<usa-add-to-cart cart="#cart" item='{"name":"Sneaker","price":89}'></usa-add-to-cart>
|
|
117
|
+
</div>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### <usa-ambient> — Ambient layer
|
|
121
|
+
|
|
122
|
+
A fixed page-wide layer: drifting particles, falling snow, twinkling stars, film grain or a gradient that shifts with scroll.
|
|
123
|
+
|
|
124
|
+
- Import: `import { defineAmbient } from 'motionary/components/page'; defineAmbient();`
|
|
125
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
126
|
+
- Attributes: `effect`, `density`, `color`
|
|
127
|
+
- Methods: `mount()`, `upd()`, `resize()`, `resize()`, `draw()`, `draw()`, `unmount()`, `caf()`
|
|
128
|
+
|
|
129
|
+
```html
|
|
130
|
+
<usa-ambient effect="snow" density="1.2"></usa-ambient>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### <usa-anim-icon> — Animated icons
|
|
134
|
+
|
|
135
|
+
Stroke icons that move: the bell rings, the heart beats, the check draws, the gear turns. Hover, click, in view or loop; decorative unless labelled.
|
|
136
|
+
|
|
137
|
+
- Import: `import { defineAnimIcon } from 'motionary/components/svg'; defineAnimIcon();`
|
|
138
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
139
|
+
- Attributes: `name`, `size`, `label`
|
|
140
|
+
- Methods: `play()`
|
|
141
|
+
|
|
142
|
+
```html
|
|
143
|
+
<usa-anim-icon name="bell" label="Notifications"></usa-anim-icon>
|
|
144
|
+
<usa-anim-icon name="heart" trigger="click"></usa-anim-icon>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### <usa-audio> — Beat-triggered effects
|
|
148
|
+
|
|
149
|
+
5.6: <usa-audio> renders a toggle (a user gesture starts Web Audio), detects beats and plays any registered effect on children with data-usa-beat="effect". JS: bindBeat(el, "pop"). Beats play nothing under reduced motion.
|
|
150
|
+
|
|
151
|
+
- Import: `import { defineAudio } from 'motionary/components/effects'; defineAudio();`
|
|
152
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
153
|
+
- Attributes: `source`
|
|
154
|
+
- Methods: `toggle()`
|
|
155
|
+
|
|
156
|
+
```html
|
|
157
|
+
<audio id="track" src="song.mp3" controls></audio>
|
|
158
|
+
<usa-audio source="#track" label="Play with visuals">
|
|
159
|
+
<div data-usa-beat="pop">♪</div>
|
|
160
|
+
</usa-audio>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### <usa-aurora> — Aurora
|
|
164
|
+
|
|
165
|
+
A slow drifting gradient mesh behind its content. Transforms only, paused off-screen, still under reduced motion.
|
|
166
|
+
|
|
167
|
+
- Import: `import { defineAurora } from 'motionary/components/background'; defineAurora();`
|
|
168
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
169
|
+
- Attributes: `colors`, `speed`, `intensity`
|
|
170
|
+
|
|
171
|
+
```html
|
|
172
|
+
<usa-aurora colors="#7c5cff,#22d3ee,#f472b6">
|
|
173
|
+
<h1>Hero</h1>
|
|
174
|
+
</usa-aurora>
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### <usa-auto-animate> — Auto-animate
|
|
178
|
+
|
|
179
|
+
Wrap a list or grid: items that are added fade in, removed ones fade out in place, and everything else glides to its new spot — on sort, filter or resize. Zero code at the call site.
|
|
180
|
+
|
|
181
|
+
- Import: `import { defineAutoAnimate } from 'motionary/components/layout'; defineAutoAnimate();`
|
|
182
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
183
|
+
- Methods: `enable()`, `disable()`
|
|
184
|
+
|
|
185
|
+
```html
|
|
186
|
+
<usa-auto-animate>
|
|
187
|
+
<ul class="todo">…</ul>
|
|
188
|
+
</usa-auto-animate>
|
|
189
|
+
|
|
190
|
+
<!-- or on any element: -->
|
|
191
|
+
<script type="module">
|
|
192
|
+
import { autoAnimate } from 'motionary/components/layout';
|
|
193
|
+
autoAnimate(document.querySelector('.grid'));
|
|
194
|
+
</script>
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### <usa-auto-skeleton> — Auto skeleton
|
|
198
|
+
|
|
199
|
+
Set loading and every heading, paragraph, image and button inside becomes a shimmering placeholder of its own size — no extra markup.
|
|
200
|
+
|
|
201
|
+
- Import: `import { defineAutoSkeleton } from 'motionary/components/page'; defineAutoSkeleton();`
|
|
202
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
203
|
+
- Attributes: `loading`
|
|
204
|
+
|
|
205
|
+
```html
|
|
206
|
+
<usa-auto-skeleton loading>
|
|
207
|
+
<h3>{{ title }}</h3>
|
|
208
|
+
<p>{{ body }}</p>
|
|
209
|
+
</usa-auto-skeleton>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### <usa-avatar-stack> — Avatar stack
|
|
213
|
+
|
|
214
|
+
Overlapping avatars that spread apart with a spring on hover; extras collapse into “+N”.
|
|
215
|
+
|
|
216
|
+
- Import: `import { defineAvatarStack } from 'motionary/components/ui'; defineAvatarStack();`
|
|
217
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
218
|
+
- Attributes: `max`, `size`, `overlap`
|
|
219
|
+
- Methods: `adoptVariants()`, `mount()`
|
|
220
|
+
|
|
221
|
+
```html
|
|
222
|
+
<usa-avatar-stack max="4">
|
|
223
|
+
<img src="a.jpg" alt="Ana">
|
|
224
|
+
…
|
|
225
|
+
</usa-avatar-stack>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### <usa-back-to-top> — Back to top
|
|
229
|
+
|
|
230
|
+
Appears after you scroll, shows reading progress as a ring and springs the page back up, then moves focus to the top.
|
|
231
|
+
|
|
232
|
+
- Import: `import { defineBackToTop } from 'motionary/components/page'; defineBackToTop();`
|
|
233
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
234
|
+
|
|
235
|
+
```html
|
|
236
|
+
<usa-back-to-top offset="400"></usa-back-to-top>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### <usa-badge> — Badge
|
|
240
|
+
|
|
241
|
+
Count or dot badge that bumps with a spring when its value changes; 99+ capping, optional pulse.
|
|
242
|
+
|
|
243
|
+
- Import: `import { defineBadge } from 'motionary/components/ui'; defineBadge();`
|
|
244
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
245
|
+
- Attributes: `value`, `max`, `dot`, `label`
|
|
246
|
+
|
|
247
|
+
```html
|
|
248
|
+
<usa-badge value="3">
|
|
249
|
+
<button>Inbox</button>
|
|
250
|
+
</usa-badge>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### <usa-badge-wall> — Badge wall
|
|
254
|
+
|
|
255
|
+
7.5: an achievement grid — locked badges are grey with a 🔒; unlock(name) flips a badge to its colour side with a shine and the “n / m unlocked” counter updates.
|
|
256
|
+
|
|
257
|
+
- Import: `import { defineBadgeWall } from 'motionary/components/widgets'; defineBadgeWall();`
|
|
258
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
259
|
+
- Events: `usa:unlock`
|
|
260
|
+
- Methods: `unlock()`
|
|
261
|
+
|
|
262
|
+
```html
|
|
263
|
+
<usa-badge-wall>
|
|
264
|
+
<li data-icon="🏆">First win</li>
|
|
265
|
+
<li data-icon="🔥" data-locked>7-day streak</li>
|
|
266
|
+
</usa-badge-wall>
|
|
267
|
+
<script>wall.unlock('7-day streak');</script>
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### <usa-bar-chart> — Animated bar chart
|
|
271
|
+
|
|
272
|
+
7.2: bars grow from the baseline in a stagger on first view and new data glides every bar to its new height — bars that appear grow in, bars that leave shrink away. Data from values/labels, <data> children or the data property.
|
|
273
|
+
|
|
274
|
+
- Import: `import { defineBarChart } from 'motionary/components/widgets'; defineBarChart();`
|
|
275
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
276
|
+
- Attributes: `horizontal`, `unit`, `max`
|
|
277
|
+
|
|
278
|
+
```html
|
|
279
|
+
<usa-bar-chart values="12,19,8,15,22" labels="Mon,Tue,Wed,Thu,Fri" unit="k"></usa-bar-chart>
|
|
280
|
+
<script>chart.data = [{ label: 'Mon', value: 18 }, …];</script>
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### <usa-bg-generator> — Background generator
|
|
284
|
+
|
|
285
|
+
9.3: a background generator — pick a palette and a style (mesh gradient, grain, stripes, dots), shuffle the seed and copy the CSS.
|
|
286
|
+
|
|
287
|
+
- Import: `import { defineBgGenerator } from 'motionary/components/widgets'; defineBgGenerator();`
|
|
288
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
289
|
+
- Attributes: `label`
|
|
290
|
+
- Events: `usa:change`
|
|
291
|
+
- Methods: `shuffle()`, `copy()`
|
|
292
|
+
|
|
293
|
+
```html
|
|
294
|
+
<usa-bg-generator palette="candy" style="mesh"></usa-bg-generator>
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### <usa-blobs> — Fluid blobs
|
|
298
|
+
|
|
299
|
+
Soft colour blobs that slowly morph and drift — a fluid gradient backdrop.
|
|
300
|
+
|
|
301
|
+
- Import: `import { defineBlobs } from 'motionary/components/background'; defineBlobs();`
|
|
302
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
303
|
+
- Methods: `mount()`
|
|
304
|
+
|
|
305
|
+
```html
|
|
306
|
+
<usa-blobs colors="#7c5cff,#22d3ee,#f472b6">…</usa-blobs>
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### <usa-bottom-sheet> — Bottom sheet
|
|
310
|
+
|
|
311
|
+
A draggable sheet with snap points, inertia and drag-down-to-dismiss — the iOS / Android pattern for web and Windows web-view apps.
|
|
312
|
+
|
|
313
|
+
- Import: `import { defineBottomSheet } from 'motionary/components/ui'; defineBottomSheet();`
|
|
314
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
315
|
+
- Attributes: `open`, `snap`
|
|
316
|
+
- Methods: `show()`, `close()`
|
|
317
|
+
|
|
318
|
+
```html
|
|
319
|
+
<usa-bottom-sheet snap="0.4,0.9" label="Filters">…</usa-bottom-sheet>
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### <usa-button> — Button deformation
|
|
323
|
+
|
|
324
|
+
Spring-driven button click deformation: squash & stretch, elastic border-radius wobble, gooey liquid droplets, and a dent toward the pressed point. Combine them with deform="squash wobble".
|
|
325
|
+
|
|
326
|
+
- Import: `import { defineButton } from 'motionary/components/click'; defineButton();`
|
|
327
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
328
|
+
- Attributes: `deform`, `state`, `shape`, `disabled`
|
|
329
|
+
- Events: `usa:submit`, `usa:state`
|
|
330
|
+
- Methods: `morphTo()`
|
|
331
|
+
|
|
332
|
+
```html
|
|
333
|
+
<usa-button deform="squash">
|
|
334
|
+
<button>Squash</button>
|
|
335
|
+
</usa-button>
|
|
336
|
+
<usa-button deform="gooey"><button>Gooey</button></usa-button>
|
|
337
|
+
<usa-button deform="dent"><button>Dent</button></usa-button>
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### <usa-card> — Card
|
|
341
|
+
|
|
342
|
+
Ten card effects you can combine (effect="lift sheen"): flip (hover or click, x/y axis), holo, glass, border-glow, conic-border, lift, spotlight, sheen, parallax-layers and expand (card → detail with FLIP + spring).
|
|
343
|
+
|
|
344
|
+
- Import: `import { defineCard } from 'motionary/components/cards'; defineCard();`
|
|
345
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
346
|
+
- Attributes: `effect`, `trigger`, `disabled`
|
|
347
|
+
- Events: `usa:flip`, `usa:expand`, `usa:collapse`
|
|
348
|
+
- Methods: `flip()`, `expand()`, `collapse()`
|
|
349
|
+
|
|
350
|
+
```html
|
|
351
|
+
<usa-card effect="lift sheen">
|
|
352
|
+
<h3>Pro plan</h3>
|
|
353
|
+
</usa-card>
|
|
354
|
+
<usa-card effect="flip" trigger="click">
|
|
355
|
+
<div data-front>Front</div>
|
|
356
|
+
<div data-back>Back</div>
|
|
357
|
+
</usa-card>
|
|
358
|
+
<usa-card effect="expand">
|
|
359
|
+
<h3>Title</h3>
|
|
360
|
+
<div data-detail>Long text… <button data-close>Close</button></div>
|
|
361
|
+
</usa-card>
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### <usa-card-stack> — Swipe stack
|
|
365
|
+
|
|
366
|
+
A deck where the top card swipes away left or right (pointer, touch, arrow keys) and the next springs forward. loop sends cards to the back.
|
|
367
|
+
|
|
368
|
+
- Import: `import { defineCardStack } from 'motionary/components/cards'; defineCardStack();`
|
|
369
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
370
|
+
- Attributes: `visible`, `offset`, `disabled`
|
|
371
|
+
- Events: `usa:swipe`, `usa:empty`
|
|
372
|
+
- Methods: `swipe()`
|
|
373
|
+
|
|
374
|
+
```html
|
|
375
|
+
<usa-card-stack loop>
|
|
376
|
+
<article>1</article>
|
|
377
|
+
<article>2</article>
|
|
378
|
+
<article>3</article>
|
|
379
|
+
</usa-card-stack>
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### <usa-carousel> — Carousel / slider
|
|
383
|
+
|
|
384
|
+
6.2: swipe, drag, arrow keys, dots and autoplay (pauses on hover, focus, off screen). Four transitions — slide, fade, scale and a 3D "cards" coverflow. Reduced motion: slides switch without movement.
|
|
385
|
+
|
|
386
|
+
- Import: `import { defineCarousel } from 'motionary/components/widgets'; defineCarousel();`
|
|
387
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
388
|
+
- Attributes: `effect`, `autoplay`, `loop`, `no-controls`, `no-dots`
|
|
389
|
+
- Events: `usa:change`
|
|
390
|
+
- Methods: `next()`, `prev()`, `goTo()`
|
|
391
|
+
|
|
392
|
+
```html
|
|
393
|
+
<usa-carousel effect="cards" loop autoplay="4000" label="Featured">
|
|
394
|
+
<img src="a.jpg" alt="…">
|
|
395
|
+
<img src="b.jpg" alt="…">
|
|
396
|
+
<img src="c.jpg" alt="…">
|
|
397
|
+
</usa-carousel>
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
### <usa-carousel-3d> — 3D carousel
|
|
401
|
+
|
|
402
|
+
Items on a 3D ring, rotated by drag, arrow keys, clicks or autoplay — with spring motion. Reduced motion shows one flat item at a time.
|
|
403
|
+
|
|
404
|
+
- Import: `import { defineCarousel3d } from 'motionary/components/cards'; defineCarousel3d();`
|
|
405
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
406
|
+
- Attributes: `radius`, `perspective`, `autoplay`
|
|
407
|
+
- Events: `usa:change`
|
|
408
|
+
- Methods: `next()`, `prev()`, `goTo()`
|
|
409
|
+
|
|
410
|
+
```html
|
|
411
|
+
<usa-carousel-3d autoplay="3000">
|
|
412
|
+
<img src="1.jpg" alt="">
|
|
413
|
+
<img src="2.jpg" alt="">
|
|
414
|
+
…
|
|
415
|
+
</usa-carousel-3d>
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
### <usa-cart-drawer> — Cart drawer
|
|
419
|
+
|
|
420
|
+
7.3: a cart button with a count badge and a drawer that slides in from the side — lines slide in (or bump their quantity), removed lines collapse, the badge bumps and the total rolls. Esc / backdrop close; focus is managed.
|
|
421
|
+
|
|
422
|
+
- Import: `import { defineCartDrawer } from 'motionary/components/widgets'; defineCartDrawer();`
|
|
423
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
424
|
+
- Events: `usa:open`, `usa:close`, `usa:change`
|
|
425
|
+
- Methods: `add()`, `removeItem()`, `toggle()`
|
|
426
|
+
|
|
427
|
+
```html
|
|
428
|
+
<usa-cart-drawer currency="$"></usa-cart-drawer>
|
|
429
|
+
<script>cart.add({ id: 'tee', name: 'T-shirt', price: 24 });</script>
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### <usa-chapter-nav> — Chapter nav
|
|
433
|
+
|
|
434
|
+
9.1: chapter navigation for long-form stories — one entry per chapter with a reading-progress bar that fills as you scroll, the current chapter highlighted, click to glide there.
|
|
435
|
+
|
|
436
|
+
- Import: `import { defineChapterNav } from 'motionary/components/widgets'; defineChapterNav();`
|
|
437
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
438
|
+
- Attributes: `for`, `orientation`, `label`
|
|
439
|
+
- Events: `usa:chapter`
|
|
440
|
+
- Methods: `goTo()`
|
|
441
|
+
|
|
442
|
+
```html
|
|
443
|
+
<usa-chapter-nav for="#story"></usa-chapter-nav>
|
|
444
|
+
<article id="story">
|
|
445
|
+
<section data-chapter="Prologue">…</section>
|
|
446
|
+
<section data-chapter="The storm">…</section>
|
|
447
|
+
</article>
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
### <usa-chat-composer> — AI chat composer
|
|
451
|
+
|
|
452
|
+
7.8: an AI chat input that grows with its text; Enter sends, the send button pops when there is text and morphs into Stop while busy, with a thinking glow running round the composer.
|
|
453
|
+
|
|
454
|
+
- Import: `import { defineChatComposer } from 'motionary/components/widgets'; defineChatComposer();`
|
|
455
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
456
|
+
- Attributes: `placeholder`, `label`, `rows`, `busy`
|
|
457
|
+
- Events: `usa:stop`, `usa:send`
|
|
458
|
+
- Methods: `send()`, `clear()`
|
|
459
|
+
|
|
460
|
+
```html
|
|
461
|
+
<usa-chat-composer placeholder="Ask anything…"></usa-chat-composer>
|
|
462
|
+
<script>composer.addEventListener('usa:send', async (e) => { composer.busy = true; await ask(e.detail.text); composer.busy = false; });</script>
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
### <usa-check> — Result icon
|
|
466
|
+
|
|
467
|
+
The circle draws itself, then a check, cross or exclamation strokes in with a pop. Great after a payment or upload.
|
|
468
|
+
|
|
469
|
+
- Import: `import { defineCheck } from 'motionary/components/feedback'; defineCheck();`
|
|
470
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
471
|
+
- Attributes: `kind`, `size`, `label`
|
|
472
|
+
- Events: `usa:complete`
|
|
473
|
+
- Methods: `play()`, `reset()`
|
|
474
|
+
|
|
475
|
+
```html
|
|
476
|
+
<usa-check kind="success" label="Payment complete"></usa-check>
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### <usa-checkbox> — Animated checkbox
|
|
480
|
+
|
|
481
|
+
Form-associated checkbox: the box springs and the check draws itself; indeterminate state, circle shape.
|
|
482
|
+
|
|
483
|
+
- Import: `import { defineCheckbox } from 'motionary/components/click'; defineCheckbox();`
|
|
484
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
485
|
+
- Attributes: `checked`, `indeterminate`, `disabled`, `label`
|
|
486
|
+
- Events: `usa:change`
|
|
487
|
+
- Methods: `toggle()`
|
|
488
|
+
|
|
489
|
+
```html
|
|
490
|
+
<usa-checkbox name="terms">I agree</usa-checkbox>
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
### <usa-click> — Click effects
|
|
494
|
+
|
|
495
|
+
Wrap anything: ripple, burst (circle, star, heart, emoji), confetti, squish, press-spring and error shake — combinable, keyboard-friendly, optional haptics.
|
|
496
|
+
|
|
497
|
+
- Import: `import { defineClick } from 'motionary/components/click'; defineClick();`
|
|
498
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
499
|
+
- Attributes: `effect`, `disabled`
|
|
500
|
+
- Events: `usa:click-effect`
|
|
501
|
+
- Methods: `play()`, `shake()`
|
|
502
|
+
|
|
503
|
+
```html
|
|
504
|
+
<usa-click effect="press-spring burst" shape="star">
|
|
505
|
+
<button>Celebrate</button>
|
|
506
|
+
</usa-click>
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
### <usa-clock-control> — Motion clock control
|
|
510
|
+
|
|
511
|
+
8.0: a pause / speed bar for the unified motion clock — pause, slow down or speed up every Motionary animation and frame loop on the page at once (motionClock in motionary/engine).
|
|
512
|
+
|
|
513
|
+
- Import: `import { defineClockControl } from 'motionary/components/widgets'; defineClockControl();`
|
|
514
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
515
|
+
- Attributes: `speeds`, `label`
|
|
516
|
+
- Events: `usa:change`
|
|
517
|
+
|
|
518
|
+
```html
|
|
519
|
+
<usa-clock-control speeds="0.25,0.5,1,2"></usa-clock-control>
|
|
520
|
+
<script type="module">
|
|
521
|
+
import { motionClock, createTimeline } from 'motionary/engine';
|
|
522
|
+
motionClock.rate = 0.5;
|
|
523
|
+
createTimeline().add(a, [{ opacity: 0 }, { opacity: 1 }], 400).add(b, [{ transform: 'scale(0)' }, { transform: 'none' }], 500, '-=200').play();
|
|
524
|
+
</script>
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### <usa-code-export> — Code export
|
|
528
|
+
|
|
529
|
+
8.9 low-code: shows copy-paste code (HTML, React, Vue or JSON) for a live, configured component next to it, follows its attribute changes and copies with one click.
|
|
530
|
+
|
|
531
|
+
- Import: `import { defineCodeExport } from 'motionary/components/widgets'; defineCodeExport();`
|
|
532
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
533
|
+
- Attributes: `for`, `formats`
|
|
534
|
+
- Events: `usa:copy`
|
|
535
|
+
- Methods: `copy()`
|
|
536
|
+
|
|
537
|
+
```html
|
|
538
|
+
<usa-code-export formats="html,react,vue">
|
|
539
|
+
<usa-star-rating value="4"></usa-star-rating>
|
|
540
|
+
</usa-code-export>
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
### <usa-color-picker> — Color picker
|
|
544
|
+
|
|
545
|
+
6.9: a saturation / brightness square and a hue strip with spring-follow thumbs (both keyboard sliders), a preview chip that morphs to the new colour and swatches that pop.
|
|
546
|
+
|
|
547
|
+
- Import: `import { defineColorPicker } from 'motionary/components/widgets'; defineColorPicker();`
|
|
548
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
549
|
+
- Attributes: `swatches`
|
|
550
|
+
- Events: `usa:change`, `usa:input`
|
|
551
|
+
|
|
552
|
+
```html
|
|
553
|
+
<usa-color-picker value="#7c5cff" swatches="#f43f5e,#f59e0b,#22c55e,#0ea5e9"></usa-color-picker>
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### <usa-command-palette> — Command palette (⌘K)
|
|
557
|
+
|
|
558
|
+
7.9: a ⌘K command palette on the native <dialog> — scales in, filters as you type with fuzzy matching and highlighted letters, results stagger in and a highlight glides between rows (↑ ↓ Enter).
|
|
559
|
+
|
|
560
|
+
- Import: `import { defineCommandPalette } from 'motionary/components/widgets'; defineCommandPalette();`
|
|
561
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
562
|
+
- Attributes: `placeholder`, `label`, `hotkey`, `inline`
|
|
563
|
+
- Events: `usa:run`, `usa:open`, `usa:close`
|
|
564
|
+
- Methods: `setCommands()`, `show()`, `close()`, `toggle()`
|
|
565
|
+
|
|
566
|
+
```html
|
|
567
|
+
<usa-command-palette>
|
|
568
|
+
<option value="new" data-group="File" data-keys="mod+n">New file</option>
|
|
569
|
+
<option value="theme" data-group="View">Toggle theme</option>
|
|
570
|
+
</usa-command-palette>
|
|
571
|
+
<script>palette.addEventListener('usa:run', (e) => run(e.detail.id));</script>
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
### <usa-compare> — Before / after compare
|
|
575
|
+
|
|
576
|
+
6.5: drag the handle (or hover with the hover attribute), click to jump, or use the keyboard slider; horizontal or vertical; an intro sweep plays once when it scrolls into view.
|
|
577
|
+
|
|
578
|
+
- Import: `import { defineCompare } from 'motionary/components/widgets'; defineCompare();`
|
|
579
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
580
|
+
- Attributes: `orientation`, `labels`
|
|
581
|
+
- Events: `usa:change`
|
|
582
|
+
|
|
583
|
+
```html
|
|
584
|
+
<usa-compare labels="Before,After" intro>
|
|
585
|
+
<img src="before.jpg" alt="Before">
|
|
586
|
+
<img src="after.jpg" alt="After">
|
|
587
|
+
</usa-compare>
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
### <usa-countdown> — Flip countdown
|
|
591
|
+
|
|
592
|
+
7.3: a split-flap countdown to a date (to) or for a number of seconds — every digit flips when it changes; fires usa:done at zero. The timer label updates once a minute so screen readers are not flooded.
|
|
593
|
+
|
|
594
|
+
- Import: `import { defineCountdown } from 'motionary/components/widgets'; defineCountdown();`
|
|
595
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
596
|
+
- Attributes: `to`, `seconds`
|
|
597
|
+
- Events: `usa:tick`, `usa:done`
|
|
598
|
+
- Methods: `start()`, `stop()`
|
|
599
|
+
|
|
600
|
+
```html
|
|
601
|
+
<usa-countdown to="2026-12-24T00:00:00" units="d,h,m,s"></usa-countdown>
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
### <usa-counter> — Number counter
|
|
605
|
+
|
|
606
|
+
Counts up to a number when visible, locale-formatted with tabular digits. Set .value to animate live dashboards.
|
|
607
|
+
|
|
608
|
+
- Import: `import { defineCounter } from 'motionary/components/text'; defineCounter();`
|
|
609
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
610
|
+
- Attributes: `to`, `decimals`, `locale`, `prefix`, `suffix`, `grouping`
|
|
611
|
+
- Events: `usa:complete`
|
|
612
|
+
- Methods: `play()`, `format()`
|
|
613
|
+
|
|
614
|
+
```html
|
|
615
|
+
<usa-counter to="128490" prefix="$" duration="2000"></usa-counter>
|
|
616
|
+
```
|
|
617
|
+
|
|
618
|
+
### <usa-cube> — 3D cube
|
|
619
|
+
|
|
620
|
+
Up to six children become the faces of a CSS 3D cube. Drag / swipe, arrow keys, autoplay or show("top"); spring-driven, the front face is the only one exposed to screen readers.
|
|
621
|
+
|
|
622
|
+
- Import: `import { defineCube } from 'motionary/components/depth'; defineCube();`
|
|
623
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
624
|
+
- Attributes: `size`, `autoplay`
|
|
625
|
+
- Events: `usa:change`
|
|
626
|
+
- Methods: `show()`, `next()`, `prev()`
|
|
627
|
+
|
|
628
|
+
```html
|
|
629
|
+
<usa-cube size="200" autoplay="3000">
|
|
630
|
+
<div>Front</div><div>Right</div><div>Back</div><div>Left</div>
|
|
631
|
+
</usa-cube>
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
### <usa-cube-gallery> — Cube gallery
|
|
635
|
+
|
|
636
|
+
6.5: slides sit on adjacent faces of a 3D cube that turns between them — swipe, arrow keys, buttons or autoplay (pauses on hover / focus / off screen); turn around the Y or X axis.
|
|
637
|
+
|
|
638
|
+
- Import: `import { defineCubeGallery } from 'motionary/components/widgets'; defineCubeGallery();`
|
|
639
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
640
|
+
- Attributes: `axis`, `autoplay`
|
|
641
|
+
- Events: `usa:change`
|
|
642
|
+
- Methods: `next()`, `prev()`, `goTo()`
|
|
643
|
+
|
|
644
|
+
```html
|
|
645
|
+
<usa-cube-gallery autoplay="4000" label="Products">
|
|
646
|
+
<img src="a.jpg" alt="…">
|
|
647
|
+
<img src="b.jpg" alt="…">
|
|
648
|
+
<img src="c.jpg" alt="…">
|
|
649
|
+
</usa-cube-gallery>
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
### <usa-cursor> — Custom cursor
|
|
653
|
+
|
|
654
|
+
A spring-lagged ring, a magnetic ring that wraps buttons and links, or a soft glow following the pointer. Mouse / pen only. (6.0: for a comet tail use the comet-trail effect.)
|
|
655
|
+
|
|
656
|
+
- Import: `import { defineCursor } from 'motionary/components/page'; defineCursor();`
|
|
657
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
658
|
+
- Attributes: `mode`, `size`, `color`, `hide-native`
|
|
659
|
+
|
|
660
|
+
```html
|
|
661
|
+
<usa-cursor mode="magnetic" hide-native></usa-cursor>
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
### <usa-date-picker> — Date picker
|
|
665
|
+
|
|
666
|
+
6.9: months slide in from the direction of travel, the chosen day pops inside a spring circle, today has a ring. A real date grid: arrows, PageUp / PageDown, Home / End, min / max.
|
|
667
|
+
|
|
668
|
+
- Import: `import { defineDatePicker } from 'motionary/components/widgets'; defineDatePicker();`
|
|
669
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
670
|
+
- Attributes: `min`, `max`, `first-day`, `locale`
|
|
671
|
+
- Events: `usa:change`
|
|
672
|
+
- Methods: `showMonth()`
|
|
673
|
+
|
|
674
|
+
```html
|
|
675
|
+
<usa-date-picker value="2026-10-08" min="2026-01-01" first-day="1"></usa-date-picker>
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
### <usa-depth> — Depth parallax
|
|
679
|
+
|
|
680
|
+
Layers with data-depth (-1…1) shift and scale by depth as the pointer moves, the phone tilts (source="orientation") or the page scrolls; optional whole-scene rotation.
|
|
681
|
+
|
|
682
|
+
- Import: `import { defineDepth } from 'motionary/components/depth'; defineDepth();`
|
|
683
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
684
|
+
- Attributes: `source`, `strength`, `rotate`
|
|
685
|
+
- Methods: `requestPermission()`
|
|
686
|
+
|
|
687
|
+
```html
|
|
688
|
+
<usa-depth source="pointer orientation" strength="40" rotate="6">
|
|
689
|
+
<div class="scene">
|
|
690
|
+
<img data-depth="-0.6" src="sky.png" alt="">
|
|
691
|
+
<img data-depth="0.2" src="hills.png" alt="">
|
|
692
|
+
<h2 data-depth="0.8">Title</h2>
|
|
693
|
+
</div>
|
|
694
|
+
</usa-depth>
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
### <usa-dialog> — Modal & drawer
|
|
698
|
+
|
|
699
|
+
Animated modal, side drawers and bottom sheet on the native <dialog>: top layer, focus trap, Esc, backdrop click.
|
|
700
|
+
|
|
701
|
+
- Import: `import { defineDialog } from 'motionary/components/transitions'; defineDialog();`
|
|
702
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
703
|
+
- Attributes: `open`, `kind`, `label`
|
|
704
|
+
- Events: `usa:open`, `usa:beforeclose`, `usa:close`
|
|
705
|
+
- Slots: default
|
|
706
|
+
- Methods: `show()`, `close()`
|
|
707
|
+
|
|
708
|
+
```html
|
|
709
|
+
<usa-dialog id="dlg" kind="modal" label="Settings">
|
|
710
|
+
<h2>Settings</h2>
|
|
711
|
+
<button data-close>Done</button>
|
|
712
|
+
</usa-dialog>
|
|
713
|
+
<button onclick="dlg.show()">Open</button>
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
### <usa-disclosure> — Accordion 2.0
|
|
717
|
+
|
|
718
|
+
6.2: native <details> that spring open and closed (height + fade) with an overshooting chevron; one open at a time unless multiple. Find-in-page and keyboard keep working.
|
|
719
|
+
|
|
720
|
+
- Import: `import { defineDisclosure } from 'motionary/components/widgets'; defineDisclosure();`
|
|
721
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
722
|
+
- Events: `usa:toggle`
|
|
723
|
+
- Methods: `toggle()`, `openAll()`, `closeAll()`
|
|
724
|
+
|
|
725
|
+
```html
|
|
726
|
+
<usa-disclosure variant="cards">
|
|
727
|
+
<details><summary>Shipping</summary><p>…</p></details>
|
|
728
|
+
<details><summary>Returns</summary><p>…</p></details>
|
|
729
|
+
</usa-disclosure>
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
### <usa-distort> — Hover distortion
|
|
733
|
+
|
|
734
|
+
The image bulges and splits into RGB around the pointer. Without WebGL (or a cross-origin image without CORS) it falls back to a gentle CSS zoom.
|
|
735
|
+
|
|
736
|
+
- Import: `import { defineDistort } from 'motionary/components/webgl'; defineDistort();`
|
|
737
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
738
|
+
|
|
739
|
+
```html
|
|
740
|
+
<usa-distort>
|
|
741
|
+
<img src="photo.jpg" alt="…">
|
|
742
|
+
</usa-distort>
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
### <usa-dock> — macOS-style dock
|
|
746
|
+
|
|
747
|
+
6.6: items magnify with a smooth cosine falloff as the pointer moves along the dock, neighbours make room, labels pop above the hovered item and a click bounces it. Keyboard focus magnifies too.
|
|
748
|
+
|
|
749
|
+
- Import: `import { defineDock } from 'motionary/components/widgets'; defineDock();`
|
|
750
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
751
|
+
- Attributes: `orientation`, `magnify`, `range`
|
|
752
|
+
|
|
753
|
+
```html
|
|
754
|
+
<usa-dock magnify="1.9" bounce label="Apps">
|
|
755
|
+
<button data-label="Finder" aria-label="Finder">🗂</button>
|
|
756
|
+
<button data-label="Music" aria-label="Music">🎵</button>
|
|
757
|
+
<a href="/mail" data-label="Mail" aria-label="Mail">✉️</a>
|
|
758
|
+
</usa-dock>
|
|
759
|
+
```
|
|
760
|
+
|
|
761
|
+
### <usa-dot-network> — Dot network
|
|
762
|
+
|
|
763
|
+
A dot grid that swells and links up with lines around the pointer.
|
|
764
|
+
|
|
765
|
+
- Import: `import { defineDotNetwork } from 'motionary/components/background'; defineDotNetwork();`
|
|
766
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
767
|
+
- Methods: `mount()`
|
|
768
|
+
|
|
769
|
+
```html
|
|
770
|
+
<usa-dot-network gap="28">…</usa-dot-network>
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
### <usa-double-tap> — Double tap
|
|
774
|
+
|
|
775
|
+
Double tap or double click a photo to pop a heart (or any emoji) at the tap point. L for keyboard users.
|
|
776
|
+
|
|
777
|
+
- Import: `import { defineDoubleTap } from 'motionary/components/click'; defineDoubleTap();`
|
|
778
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
779
|
+
- Events: `usa:double-tap`
|
|
780
|
+
- Methods: `pop()`
|
|
781
|
+
|
|
782
|
+
```html
|
|
783
|
+
<usa-double-tap>
|
|
784
|
+
<img src="photo.jpg" alt="…">
|
|
785
|
+
</usa-double-tap>
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
### <usa-draggable> — Draggable
|
|
789
|
+
|
|
790
|
+
Drag with mouse, touch, pen or arrow keys. spring-back returns home with a wobble; inertia glides after a flick; snap to a grid or points; rubber-band bounds.
|
|
791
|
+
|
|
792
|
+
- Import: `import { defineDraggable } from 'motionary/components/physics'; defineDraggable();`
|
|
793
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
794
|
+
- Attributes: `axis`, `disabled`, `preset`
|
|
795
|
+
- Events: `usa:settle`, `usa:drag-start`, `usa:drag`, `usa:drag-end`
|
|
796
|
+
- Methods: `moveTo()`, `reset()`
|
|
797
|
+
|
|
798
|
+
```html
|
|
799
|
+
<usa-draggable spring-back>
|
|
800
|
+
<div class="card">Drag me</div>
|
|
801
|
+
</usa-draggable>
|
|
802
|
+
<usa-draggable inertia snap="80" bounds="parent">…</usa-draggable>
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
### <usa-draw> — Line drawing
|
|
806
|
+
|
|
807
|
+
Every stroke of the SVG inside draws itself — on view, hover, click or scrubbed with scroll — staggered between shapes, optional fill afterwards. No getTotalLength() needed.
|
|
808
|
+
|
|
809
|
+
- Import: `import { defineDraw } from 'motionary/components/svg'; defineDraw();`
|
|
810
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
811
|
+
- Events: `usa:complete`
|
|
812
|
+
- Methods: `play()`
|
|
813
|
+
|
|
814
|
+
```html
|
|
815
|
+
<usa-draw duration="1800" stagger="0.3" fill>
|
|
816
|
+
<svg viewBox="0 0 100 40">…</svg>
|
|
817
|
+
</usa-draw>
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
### <usa-drawer> — Drawer
|
|
821
|
+
|
|
822
|
+
A side panel that springs in, drags / swipes closed, traps the page behind a backdrop and returns focus on close. Left, right, top or bottom.
|
|
823
|
+
|
|
824
|
+
- Import: `import { defineDrawer } from 'motionary/components/ui'; defineDrawer();`
|
|
825
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
826
|
+
- Methods: `show()`, `close()`
|
|
827
|
+
|
|
828
|
+
```html
|
|
829
|
+
<button onclick="nav.open = true">Menu</button>
|
|
830
|
+
<usa-drawer id="nav" side="left" label="Navigation">…</usa-drawer>
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### <usa-equalizer> — Graphic equalizer
|
|
834
|
+
|
|
835
|
+
7.1: one vertical slider per band with springy caps and a smooth response curve drawn through them; presets glide every band to its gain.
|
|
836
|
+
|
|
837
|
+
- Import: `import { defineEqualizer } from 'motionary/components/widgets'; defineEqualizer();`
|
|
838
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
839
|
+
- Attributes: `bands`
|
|
840
|
+
- Events: `usa:change`
|
|
841
|
+
- Methods: `applyPreset()`
|
|
842
|
+
|
|
843
|
+
```html
|
|
844
|
+
<usa-equalizer preset="rock" bands="60,150,400,1k,2.4k,6k,16k"></usa-equalizer>
|
|
845
|
+
<script>eq.applyPreset('vocal');</script>
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
### <usa-fab> — FAB speed dial
|
|
849
|
+
|
|
850
|
+
A floating action button whose actions fan out with a staggered spring: up, down, left, right or radial.
|
|
851
|
+
|
|
852
|
+
- Import: `import { defineFab } from 'motionary/components/ui'; defineFab();`
|
|
853
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
854
|
+
- Attributes: `direction`, `gap`
|
|
855
|
+
- Events: `usa:toggle`
|
|
856
|
+
- Methods: `toggle()`
|
|
857
|
+
|
|
858
|
+
```html
|
|
859
|
+
<usa-fab direction="up">
|
|
860
|
+
<button aria-label="Create">+</button>
|
|
861
|
+
<button aria-label="Photo">📷</button>
|
|
862
|
+
<button aria-label="Note">📝</button>
|
|
863
|
+
</usa-fab>
|
|
864
|
+
```
|
|
865
|
+
|
|
866
|
+
### <usa-festival-banner> — Festival banner
|
|
867
|
+
|
|
868
|
+
8.1: an announcement banner with an ambient festive scene behind the text — lunar lanterns and sparkles, Christmas lights and snow, Halloween bats and moon, or fireworks.
|
|
869
|
+
|
|
870
|
+
- Import: `import { defineFestivalBanner } from 'motionary/components/widgets'; defineFestivalBanner();`
|
|
871
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
872
|
+
- Attributes: `theme`, `label`, `dismissible`
|
|
873
|
+
- Events: `usa:dismiss`
|
|
874
|
+
- Methods: `dismiss()`
|
|
875
|
+
|
|
876
|
+
```html
|
|
877
|
+
<usa-festival-banner theme="lunar" dismissible>🧧 Happy Lunar New Year — 20% off all week</usa-festival-banner>
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
### <usa-field> — Animated field
|
|
881
|
+
|
|
882
|
+
7.7: a text input whose label floats up on focus, with a growing underline; validates on blur — invalid shakes and slides the message in, valid draws a check. strength adds a 4-step password meter.
|
|
883
|
+
|
|
884
|
+
- Import: `import { defineField } from 'motionary/components/widgets'; defineField();`
|
|
885
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
886
|
+
- Attributes: `label`, `hint`, `error`, `strength`
|
|
887
|
+
- Events: `usa:invalid`, `usa:valid`
|
|
888
|
+
- Methods: `validate()`
|
|
889
|
+
|
|
890
|
+
```html
|
|
891
|
+
<usa-field label="Email" type="email" name="email" required></usa-field>
|
|
892
|
+
<usa-field label="Password" type="password" name="pw" minlength="8" strength></usa-field>
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
### <usa-file-drop> — File drop zone
|
|
896
|
+
|
|
897
|
+
6.9: dragging files over it lights marching-ants borders and lifts the icon; dropped (or browsed) files fly into a list with progress bars that end in a drawn check.
|
|
898
|
+
|
|
899
|
+
- Import: `import { defineFileDrop } from 'motionary/components/widgets'; defineFileDrop();`
|
|
900
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
901
|
+
- Events: `usa:files`
|
|
902
|
+
- Methods: `setProgress()`, `addFiles()`, `clear()`
|
|
903
|
+
|
|
904
|
+
```html
|
|
905
|
+
<usa-file-drop multiple accept="image/*" label="Drop images or browse"></usa-file-drop>
|
|
906
|
+
<script>
|
|
907
|
+
drop.addEventListener('usa:files', (e) => upload(e.detail.files, (i, p) => drop.setProgress(i, p)));
|
|
908
|
+
</script>
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
### <usa-fullpage> — Full-page sections
|
|
912
|
+
|
|
913
|
+
Full-screen sections that snap one at a time, with keyboard paging, dot navigation and a usa:section event.
|
|
914
|
+
|
|
915
|
+
- Import: `import { defineFullpage } from 'motionary/components/page'; defineFullpage();`
|
|
916
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
917
|
+
- Events: `usa:section`
|
|
918
|
+
- Methods: `go()`, `next()`, `prev()`
|
|
919
|
+
|
|
920
|
+
```html
|
|
921
|
+
<usa-fullpage dots>
|
|
922
|
+
<section>One</section>
|
|
923
|
+
<section>Two</section>
|
|
924
|
+
</usa-fullpage>
|
|
925
|
+
```
|
|
926
|
+
|
|
927
|
+
### <usa-fx> — Attention seekers
|
|
928
|
+
|
|
929
|
+
<usa-fx> plays any registered effect on its child: pulse, pop, jelly, wiggle, heartbeat, bounce, flash (≤ 2 per second), tada, shake. Click the button.
|
|
930
|
+
|
|
931
|
+
- Import: `import { defineFx } from 'motionary/components/fx'; defineFx();`
|
|
932
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
933
|
+
- Attributes: `effect`, `trigger`, `options`
|
|
934
|
+
- Methods: `play()`
|
|
935
|
+
|
|
936
|
+
```html
|
|
937
|
+
<usa-fx effect="jelly" trigger="click">
|
|
938
|
+
<button>Press me</button>
|
|
939
|
+
</usa-fx>
|
|
940
|
+
```
|
|
941
|
+
|
|
942
|
+
### <usa-gauge> — Spring gauge
|
|
943
|
+
|
|
944
|
+
7.2: a semicircular gauge — the needle swings to the value on a damped spring (overshoot, settle), the arc fills in the colour of its zone and the number counts. role="meter".
|
|
945
|
+
|
|
946
|
+
- Import: `import { defineGauge } from 'motionary/components/widgets'; defineGauge();`
|
|
947
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
948
|
+
- Attributes: `min`, `max`, `zones`, `unit`, `label`
|
|
949
|
+
|
|
950
|
+
```html
|
|
951
|
+
<usa-gauge value="72" unit="%" label="CPU" zones="60:#22c55e,85:#f59e0b,100:#ef4444"></usa-gauge>
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
### <usa-gen-art> — Generative artwork
|
|
955
|
+
|
|
956
|
+
9.3: seeded generative art on a canvas — flow fields, circle packing, Truchet tiles or layered waves in curated palettes; it draws itself in on screen and a tap re-seeds it.
|
|
957
|
+
|
|
958
|
+
- Import: `import { defineGenArt } from 'motionary/components/widgets'; defineGenArt();`
|
|
959
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
960
|
+
- Attributes: `art`, `seed`, `palette`, `label`
|
|
961
|
+
- Events: `usa:generate`
|
|
962
|
+
- Methods: `generate()`, `toDataURL()`
|
|
963
|
+
|
|
964
|
+
```html
|
|
965
|
+
<usa-gen-art art="flow" seed="7" palette="ocean" style="height:240px"></usa-gen-art>
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
### <usa-gesture-fx> — Gesture triggers
|
|
969
|
+
|
|
970
|
+
5.7: <usa-gesture-fx> plays any registered effect on a fling (fast release), a two-finger twist or a long press that charges --usa-charge 0 → 1. JS: bindGesture(el, "fling", "tada").
|
|
971
|
+
|
|
972
|
+
- Import: `import { defineGestureFx } from 'motionary/components/effects'; defineGestureFx();`
|
|
973
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
974
|
+
- Attributes: `gesture`, `effect`, `options`
|
|
975
|
+
|
|
976
|
+
```html
|
|
977
|
+
<usa-gesture-fx gesture="long-press" effect="tada">
|
|
978
|
+
<button>Hold me</button>
|
|
979
|
+
</usa-gesture-fx>
|
|
980
|
+
```
|
|
981
|
+
|
|
982
|
+
### <usa-gesture-sticker> — Multi-touch sticker
|
|
983
|
+
|
|
984
|
+
8.7: a multi-touch sticker — drag with one finger, pinch with two to scale and twist to rotate, all at once, with a lifted shadow while held (wheel / Shift + wheel and keyboard on desktop).
|
|
985
|
+
|
|
986
|
+
- Import: `import { defineGestureSticker } from 'motionary/components/widgets'; defineGestureSticker();`
|
|
987
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
988
|
+
- Attributes: `min`, `max`, `label`
|
|
989
|
+
- Events: `usa:transform`
|
|
990
|
+
- Methods: `transformTo()`, `reset()`
|
|
991
|
+
|
|
992
|
+
```html
|
|
993
|
+
<usa-gesture-sticker label="Star sticker" max="3">
|
|
994
|
+
<img src="star.png" alt="Star" width="120">
|
|
995
|
+
</usa-gesture-sticker>
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
### <usa-glitch> — Glitch text
|
|
999
|
+
|
|
1000
|
+
An RGB-split, sliced glitch — always on or on hover.
|
|
1001
|
+
|
|
1002
|
+
- Import: `import { defineGlitch } from 'motionary/components/text'; defineGlitch();`
|
|
1003
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1004
|
+
- Attributes: `text`, `intensity`
|
|
1005
|
+
- Methods: `mount()`, `splitChars()`
|
|
1006
|
+
|
|
1007
|
+
```html
|
|
1008
|
+
<usa-glitch trigger="hover">SYSTEM ERROR</usa-glitch>
|
|
1009
|
+
```
|
|
1010
|
+
|
|
1011
|
+
### <usa-globe> — Spinning globe
|
|
1012
|
+
|
|
1013
|
+
7.6: an SVG globe in orthographic projection — graticule, pulsing markers, spins while on screen, drag to turn it, flyTo(name) brings a city round to the front. No WebGL, no tiles.
|
|
1014
|
+
|
|
1015
|
+
- Import: `import { defineGlobe } from 'motionary/components/widgets'; defineGlobe();`
|
|
1016
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1017
|
+
- Attributes: `markers`, `speed`, `tilt`
|
|
1018
|
+
- Events: `usa:focus`
|
|
1019
|
+
- Methods: `flyTo()`
|
|
1020
|
+
|
|
1021
|
+
```html
|
|
1022
|
+
<usa-globe markers="Shanghai:31.2,121.5; London:51.5,-0.1; New York:40.7,-74"></usa-globe>
|
|
1023
|
+
<script>globe.flyTo('London');</script>
|
|
1024
|
+
```
|
|
1025
|
+
|
|
1026
|
+
### <usa-gradient-text> — Gradient flow
|
|
1027
|
+
|
|
1028
|
+
Text filled with a multi-colour gradient that keeps flowing.
|
|
1029
|
+
|
|
1030
|
+
- Import: `import { defineGradientText } from 'motionary/components/text'; defineGradientText();`
|
|
1031
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1032
|
+
- Attributes: `colors`, `speed`, `angle`
|
|
1033
|
+
- Methods: `mount()`, `splitChars()`
|
|
1034
|
+
|
|
1035
|
+
```html
|
|
1036
|
+
<usa-gradient-text colors="#7c5cff,#22d3ee,#f472b6">Gradient</usa-gradient-text>
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
### <usa-grain> — Film grain
|
|
1040
|
+
|
|
1041
|
+
An SVG-noise grain overlay — no image to ship. animated makes it jitter like film.
|
|
1042
|
+
|
|
1043
|
+
- Import: `import { defineGrain } from 'motionary/components/background'; defineGrain();`
|
|
1044
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1045
|
+
- Attributes: `opacity`, `blend`, `scale`
|
|
1046
|
+
|
|
1047
|
+
```html
|
|
1048
|
+
<usa-grain animated opacity="0.15">
|
|
1049
|
+
<img src="hero.jpg" alt="">
|
|
1050
|
+
</usa-grain>
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
### <usa-grid-glow> — Grid glow
|
|
1054
|
+
|
|
1055
|
+
A line grid behind the content that lights up around the pointer.
|
|
1056
|
+
|
|
1057
|
+
- Import: `import { defineGridGlow } from 'motionary/components/background'; defineGridGlow();`
|
|
1058
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1059
|
+
- Methods: `mount()`
|
|
1060
|
+
|
|
1061
|
+
```html
|
|
1062
|
+
<usa-grid-glow size="32">
|
|
1063
|
+
<h2>Hero</h2>
|
|
1064
|
+
</usa-grid-glow>
|
|
1065
|
+
```
|
|
1066
|
+
|
|
1067
|
+
### <usa-gyro-card> — Gyro 3D card
|
|
1068
|
+
|
|
1069
|
+
8.7: a 3D card that tilts with the phone’s gyroscope (and with the pointer on desktop), with a moving glare and layers that float at different depths.
|
|
1070
|
+
|
|
1071
|
+
- Import: `import { defineGyroCard } from 'motionary/components/widgets'; defineGyroCard();`
|
|
1072
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1073
|
+
- Attributes: `max`, `glare`
|
|
1074
|
+
- Events: `usa:tilt`
|
|
1075
|
+
- Methods: `tilt()`, `wobble()`
|
|
1076
|
+
|
|
1077
|
+
```html
|
|
1078
|
+
<usa-gyro-card max="15">
|
|
1079
|
+
<h3 data-depth="2">Gyro</h3>
|
|
1080
|
+
<p data-depth="1">Tilt your phone</p>
|
|
1081
|
+
</usa-gyro-card>
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
### <usa-handwriting> — Handwriting draw
|
|
1085
|
+
|
|
1086
|
+
The text draws itself stroke by stroke, then fills in — signatures, hero words.
|
|
1087
|
+
|
|
1088
|
+
- Import: `import { defineHandwriting } from 'motionary/components/text'; defineHandwriting();`
|
|
1089
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1090
|
+
- Attributes: `text`, `size`, `font`
|
|
1091
|
+
- Events: `usa:complete`
|
|
1092
|
+
- Methods: `mount()`, `splitChars()`
|
|
1093
|
+
|
|
1094
|
+
```html
|
|
1095
|
+
<usa-handwriting text="Thank you" size="72"></usa-handwriting>
|
|
1096
|
+
```
|
|
1097
|
+
|
|
1098
|
+
### <usa-hero-video> — Hero video
|
|
1099
|
+
|
|
1100
|
+
9.4: a full-bleed hero with a background video — poster first, cross-fade to the video, a readable scrim, an always-there pause button and an optional scroll-scrubbed mode.
|
|
1101
|
+
|
|
1102
|
+
- Import: `import { defineHeroVideo } from 'motionary/components/widgets'; defineHeroVideo();`
|
|
1103
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1104
|
+
- Attributes: `label`, `scrub`, `poster`
|
|
1105
|
+
- Methods: `toggle()`
|
|
1106
|
+
|
|
1107
|
+
```html
|
|
1108
|
+
<usa-hero-video label="Welcome" poster="poster.jpg">
|
|
1109
|
+
<video src="hero.mp4" autoplay muted loop playsinline></video>
|
|
1110
|
+
<h1>Motion, declared.</h1>
|
|
1111
|
+
</usa-hero-video>
|
|
1112
|
+
```
|
|
1113
|
+
|
|
1114
|
+
### <usa-hold> — Hold to confirm
|
|
1115
|
+
|
|
1116
|
+
Press and hold (pointer, Space or Enter) while a ring fills; releasing early rewinds. For destructive actions.
|
|
1117
|
+
|
|
1118
|
+
- Import: `import { defineHold } from 'motionary/components/click'; defineHold();`
|
|
1119
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1120
|
+
- Attributes: `duration`, `disabled`
|
|
1121
|
+
- Events: `usa:progress`, `usa:confirm`, `usa:cancel`
|
|
1122
|
+
- Methods: `cancel()`
|
|
1123
|
+
|
|
1124
|
+
```html
|
|
1125
|
+
<usa-hold duration="1200" label="Delete project">Hold to delete</usa-hold>
|
|
1126
|
+
```
|
|
1127
|
+
|
|
1128
|
+
### <usa-hud-panel> — HUD panel
|
|
1129
|
+
|
|
1130
|
+
8.4: a sci-fi HUD panel — angled corners, a glowing frame that draws itself in when the panel scrolls into view, a header with a blinking status light, and data rows that fill in as animated bar readouts.
|
|
1131
|
+
|
|
1132
|
+
- Import: `import { defineHudPanel } from 'motionary/components/widgets'; defineHudPanel();`
|
|
1133
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1134
|
+
- Attributes: `title`, `status`, `color`
|
|
1135
|
+
- Events: `usa:boot`
|
|
1136
|
+
- Methods: `boot()`
|
|
1137
|
+
|
|
1138
|
+
```html
|
|
1139
|
+
<usa-hud-panel title="SHIP STATUS" status="ONLINE">
|
|
1140
|
+
<p data-value="82">Shields</p>
|
|
1141
|
+
<p data-value="47">Fuel</p>
|
|
1142
|
+
</usa-hud-panel>
|
|
1143
|
+
```
|
|
1144
|
+
|
|
1145
|
+
### <usa-hydrate> — SSR hydration animation
|
|
1146
|
+
|
|
1147
|
+
8.0: server-rendered children animate in on hydration — hidden only while JS is on and not yet upgraded (ssrHead() in the head, 3 s CSS fallback), then staggered in on the unified clock.
|
|
1148
|
+
|
|
1149
|
+
- Import: `import { defineHydrate } from 'motionary/components/widgets'; defineHydrate();`
|
|
1150
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1151
|
+
- Attributes: `effect`, `stagger`, `duration`
|
|
1152
|
+
- Events: `usa:hydrated`
|
|
1153
|
+
- Methods: `replay()`
|
|
1154
|
+
|
|
1155
|
+
```html
|
|
1156
|
+
<!-- <head> -->${ssrHead()}
|
|
1157
|
+
<usa-hydrate effect="fade-up" stagger="80">
|
|
1158
|
+
<h1>Server-rendered title</h1>
|
|
1159
|
+
<p>…</p>
|
|
1160
|
+
</usa-hydrate>
|
|
1161
|
+
<!-- or: <section data-usa-hydrate="blur">…</section> + hydrateMotion() -->
|
|
1162
|
+
```
|
|
1163
|
+
|
|
1164
|
+
### <usa-icon-morph> — Icon morph
|
|
1165
|
+
|
|
1166
|
+
Icons that morph point-by-point with a spring: play ↔ pause, menu ↔ close, plus ↔ minus, check, arrow. toggle makes it a button with per-icon labels.
|
|
1167
|
+
|
|
1168
|
+
- Import: `import { defineIconMorph } from 'motionary/components/click'; defineIconMorph();`
|
|
1169
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1170
|
+
- Attributes: `icons`, `size`, `toggle`
|
|
1171
|
+
- Events: `usa:change`
|
|
1172
|
+
- Methods: `next()`, `show()`
|
|
1173
|
+
|
|
1174
|
+
```html
|
|
1175
|
+
<usa-icon-morph icons="play,pause" labels="Play,Pause" toggle></usa-icon-morph>
|
|
1176
|
+
<usa-icon-morph icons="menu,close" labels="Open menu,Close menu" toggle></usa-icon-morph>
|
|
1177
|
+
```
|
|
1178
|
+
|
|
1179
|
+
### <usa-install-button> — Install button
|
|
1180
|
+
|
|
1181
|
+
10.1: one-click install snippet with npm / pnpm / yarn / bun / CDN tabs and a copy button that confirms with a check; `cdn` sets the URL of the CDN tab.
|
|
1182
|
+
|
|
1183
|
+
- Import: `import { defineInstallButton } from 'motionary/components/widgets'; defineInstallButton();`
|
|
1184
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1185
|
+
- Attributes: `package`, `managers`, `cdn`, `dev`, `manager`
|
|
1186
|
+
- Events: `usa:copy`
|
|
1187
|
+
- Methods: `command()`, `copy()`
|
|
1188
|
+
|
|
1189
|
+
```html
|
|
1190
|
+
<usa-install-button package="motionary" managers="npm pnpm yarn bun cdn" cdn="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></usa-install-button>
|
|
1191
|
+
```
|
|
1192
|
+
|
|
1193
|
+
### <usa-kanban> — Kanban board (drag-sort)
|
|
1194
|
+
|
|
1195
|
+
6.8: drag cards between columns — the card lifts and tilts toward the drag, a placeholder opens where it will land and the other cards glide aside (FLIP). Full keyboard support: Space picks up, arrows move, Space drops.
|
|
1196
|
+
|
|
1197
|
+
- Import: `import { defineKanban } from 'motionary/components/widgets'; defineKanban();`
|
|
1198
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1199
|
+
- Events: `usa:move`
|
|
1200
|
+
- Methods: `cardsOf()`, `move()`
|
|
1201
|
+
|
|
1202
|
+
```html
|
|
1203
|
+
<usa-kanban label="Sprint">
|
|
1204
|
+
<section data-title="To do">
|
|
1205
|
+
<h3>To do</h3>
|
|
1206
|
+
<div data-card>Design</div>
|
|
1207
|
+
<div data-card>Write docs</div>
|
|
1208
|
+
</section>
|
|
1209
|
+
<section data-title="Done"><h3>Done</h3></section>
|
|
1210
|
+
</usa-kanban>
|
|
1211
|
+
```
|
|
1212
|
+
|
|
1213
|
+
### <usa-keyframe-editor> — Animation editor 2.0
|
|
1214
|
+
|
|
1215
|
+
6.9: a compact timeline for <usa-player> JSON — drag a bar to move a track, drag its edge to resize, scrub the playhead or press play; exports format use-scroll-animate/animation v1.
|
|
1216
|
+
|
|
1217
|
+
- Import: `import { defineKeyframeEditor } from 'motionary/components/widgets'; defineKeyframeEditor();`
|
|
1218
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1219
|
+
- Events: `usa:change`
|
|
1220
|
+
- Methods: `toJSON()`, `play()`, `seek()`
|
|
1221
|
+
|
|
1222
|
+
```html
|
|
1223
|
+
<div id="hero"><h1>Title</h1><div class="card">…</div><button>Go</button></div>
|
|
1224
|
+
<usa-keyframe-editor for="hero"></usa-keyframe-editor>
|
|
1225
|
+
<script>
|
|
1226
|
+
editor.addEventListener('usa:change', (e) => save(e.detail.animation));
|
|
1227
|
+
</script>
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
### <usa-kpi> — KPI card
|
|
1231
|
+
|
|
1232
|
+
7.2: the value counts up keeping prefix, suffix and decimals ("$12.4k", "98.2%"), the delta chip slides in with an arrow coloured by sign, and an optional trend draws a sparkline. Setting value rolls and flashes the card.
|
|
1233
|
+
|
|
1234
|
+
- Import: `import { defineKpi } from 'motionary/components/widgets'; defineKpi();`
|
|
1235
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1236
|
+
- Attributes: `label`, `delta`, `caption`, `trend`, `invert`
|
|
1237
|
+
|
|
1238
|
+
```html
|
|
1239
|
+
<usa-kpi label="Revenue" value="$48.2k" delta="+12.5%" trend="4,6,5,9,8,12" caption="vs last month"></usa-kpi>
|
|
1240
|
+
```
|
|
1241
|
+
|
|
1242
|
+
### <usa-leaderboard> — Leaderboard
|
|
1243
|
+
|
|
1244
|
+
7.5: a ranked list — when scores change, rows glide to their new rank, climbers flash green with ▲n and fallers red with ▼n, scores roll and the top three get medals.
|
|
1245
|
+
|
|
1246
|
+
- Import: `import { defineLeaderboard } from 'motionary/components/widgets'; defineLeaderboard();`
|
|
1247
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1248
|
+
- Events: `usa:rank`
|
|
1249
|
+
- Methods: `setScore()`
|
|
1250
|
+
|
|
1251
|
+
```html
|
|
1252
|
+
<usa-leaderboard me="Ada">
|
|
1253
|
+
<li data-score="980">Ada</li>
|
|
1254
|
+
<li data-score="870">Alan</li>
|
|
1255
|
+
<li data-score="760">Grace</li>
|
|
1256
|
+
</usa-leaderboard>
|
|
1257
|
+
<script>board.setScore('Grace', 1000);</script>
|
|
1258
|
+
```
|
|
1259
|
+
|
|
1260
|
+
### <usa-like> — Like button
|
|
1261
|
+
|
|
1262
|
+
A heart that pops with a spring and bursts into particles; aria-pressed, optional count.
|
|
1263
|
+
|
|
1264
|
+
- Import: `import { defineLike } from 'motionary/components/click'; defineLike();`
|
|
1265
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1266
|
+
- Attributes: `liked`, `count`, `label`, `disabled`
|
|
1267
|
+
- Events: `usa:change`
|
|
1268
|
+
- Methods: `toggle()`
|
|
1269
|
+
|
|
1270
|
+
```html
|
|
1271
|
+
<usa-like count="128"></usa-like>
|
|
1272
|
+
```
|
|
1273
|
+
|
|
1274
|
+
### <usa-liquid> — Liquid image
|
|
1275
|
+
|
|
1276
|
+
Click or tap to send water ripples through the image; hover adds a gentle wobble. The plain image stays when WebGL is unavailable.
|
|
1277
|
+
|
|
1278
|
+
- Import: `import { defineLiquid } from 'motionary/components/webgl'; defineLiquid();`
|
|
1279
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1280
|
+
|
|
1281
|
+
```html
|
|
1282
|
+
<usa-liquid strength="1">
|
|
1283
|
+
<img src="photo.jpg" alt="…">
|
|
1284
|
+
</usa-liquid>
|
|
1285
|
+
```
|
|
1286
|
+
|
|
1287
|
+
### <usa-liquid-nav> — Liquid nav
|
|
1288
|
+
|
|
1289
|
+
8.3: a navigation bar whose active indicator is a drop of liquid — it stretches like a droplet towards the next item and settles with a wobble (gooey SVG filter).
|
|
1290
|
+
|
|
1291
|
+
- Import: `import { defineLiquidNav } from 'motionary/components/widgets'; defineLiquidNav();`
|
|
1292
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1293
|
+
- Attributes: `label`
|
|
1294
|
+
- Events: `usa:change`
|
|
1295
|
+
|
|
1296
|
+
```html
|
|
1297
|
+
<usa-liquid-nav label="Main">
|
|
1298
|
+
<a href="/" aria-current="page">Home</a><a href="/shop">Shop</a><a href="/about">About</a>
|
|
1299
|
+
</usa-liquid-nav>
|
|
1300
|
+
```
|
|
1301
|
+
|
|
1302
|
+
### <usa-loading-bar> — Top loading bar
|
|
1303
|
+
|
|
1304
|
+
A slim NProgress-style bar for route changes and fetches: loadingBar.start() trickles, done() completes and fades.
|
|
1305
|
+
|
|
1306
|
+
- Import: `import { defineLoadingBar } from 'motionary/components/page'; defineLoadingBar();`
|
|
1307
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1308
|
+
- Methods: `start()`, `set()`, `done()`
|
|
1309
|
+
|
|
1310
|
+
```html
|
|
1311
|
+
<script type="module">
|
|
1312
|
+
import { loadingBar } from 'motionary/components/page';
|
|
1313
|
+
await loadingBar.track(fetch('/api'));
|
|
1314
|
+
</script>
|
|
1315
|
+
```
|
|
1316
|
+
|
|
1317
|
+
### <usa-location-card> — Location card
|
|
1318
|
+
|
|
1319
|
+
7.6: a place card with a stylised mini map — the route from the origin draws itself, the pin drops in with a bounce and a ring pulses; distance computed with haversine (km or mi).
|
|
1320
|
+
|
|
1321
|
+
- Import: `import { defineLocationCard } from 'motionary/components/widgets'; defineLocationCard();`
|
|
1322
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1323
|
+
- Attributes: `name`, `address`, `lat`, `lon`, `from-lat`, `from-lon`, `distance`, `href`, `unit`
|
|
1324
|
+
- Events: `usa:arrive`
|
|
1325
|
+
- Methods: `replay()`
|
|
1326
|
+
|
|
1327
|
+
```html
|
|
1328
|
+
<usa-location-card name="Blue Bottle" address="66 Mint St, San Francisco"
|
|
1329
|
+
lat="37.782" lon="-122.407" from-lat="37.776" from-lon="-122.394" href="https://maps.example/…"></usa-location-card>
|
|
1330
|
+
```
|
|
1331
|
+
|
|
1332
|
+
### <usa-lottie> — Lottie player
|
|
1333
|
+
|
|
1334
|
+
9.2: plays Lottie (After Effects / bodymovin) files without lottie-web — vector layers render as SVG and their keyframes run as native animations on Motionary’s clock.
|
|
1335
|
+
|
|
1336
|
+
- Import: `import { defineLottie } from 'motionary/components/widgets'; defineLottie();`
|
|
1337
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1338
|
+
- Attributes: `src`, `loop`, `speed`, `label`
|
|
1339
|
+
- Events: `usa:error`, `usa:load`, `usa:complete`
|
|
1340
|
+
- Methods: `play()`, `pause()`, `stop()`
|
|
1341
|
+
|
|
1342
|
+
```html
|
|
1343
|
+
<usa-lottie src="confetti.json" autoplay loop label="Celebration"></usa-lottie>
|
|
1344
|
+
```
|
|
1345
|
+
|
|
1346
|
+
### <usa-lottie-icon> — Animated icon set
|
|
1347
|
+
|
|
1348
|
+
9.2: an animated icon set shipped as tiny Lottie files — heart beat, bell swing, check draw-in, spinner, star twinkle, bolt zap — on click, hover, enter or loop.
|
|
1349
|
+
|
|
1350
|
+
- Import: `import { defineLottieIcon } from 'motionary/components/widgets'; defineLottieIcon();`
|
|
1351
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1352
|
+
- Attributes: `name`, `size`, `color`, `label`, `trigger`
|
|
1353
|
+
- Methods: `play()`
|
|
1354
|
+
|
|
1355
|
+
```html
|
|
1356
|
+
<usa-lottie-icon name="heart" trigger="click" size="32" label="Like"></usa-lottie-icon>
|
|
1357
|
+
<usa-lottie-icon name="bell" trigger="hover"></usa-lottie-icon>
|
|
1358
|
+
```
|
|
1359
|
+
|
|
1360
|
+
### <usa-lyrics> — Synced karaoke lyrics
|
|
1361
|
+
|
|
1362
|
+
7.1: LRC or [data-t] lines; the active line glows, scrolls to the centre and a highlight sweeps across it while past lines dim. Follows an <audio>, <video> or <usa-music-player> via for.
|
|
1363
|
+
|
|
1364
|
+
- Import: `import { defineLyrics } from 'motionary/components/widgets'; defineLyrics();`
|
|
1365
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1366
|
+
- Events: `usa:seek`
|
|
1367
|
+
|
|
1368
|
+
```html
|
|
1369
|
+
<usa-lyrics for="player">
|
|
1370
|
+
<script type="text/plain">
|
|
1371
|
+
[00:01.00] First line
|
|
1372
|
+
[00:04.50] Second line
|
|
1373
|
+
</script>
|
|
1374
|
+
</usa-lyrics>
|
|
1375
|
+
```
|
|
1376
|
+
|
|
1377
|
+
### <usa-magnetic> — Magnetic button
|
|
1378
|
+
|
|
1379
|
+
Content leans toward the pointer when it comes near and springs back. Fine pointers only; off under reduced motion.
|
|
1380
|
+
|
|
1381
|
+
- Import: `import { defineMagnetic } from 'motionary/components/interaction'; defineMagnetic();`
|
|
1382
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1383
|
+
- Attributes: `strength`, `radius`, `disabled`
|
|
1384
|
+
|
|
1385
|
+
```html
|
|
1386
|
+
<usa-magnetic strength="0.4"><button>Hover near me</button></usa-magnetic>
|
|
1387
|
+
```
|
|
1388
|
+
|
|
1389
|
+
### <usa-marquee> — Marquee
|
|
1390
|
+
|
|
1391
|
+
A seamless infinite ticker with constant speed, pause on hover, soft edges and vertical mode. Clones are hidden from AT.
|
|
1392
|
+
|
|
1393
|
+
- Import: `import { defineMarquee } from 'motionary/components/background'; defineMarquee();`
|
|
1394
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1395
|
+
- Attributes: `speed`, `direction`, `gap`, `paused`
|
|
1396
|
+
- Methods: `pause()`, `resume()`
|
|
1397
|
+
|
|
1398
|
+
```html
|
|
1399
|
+
<usa-marquee speed="50" pause-on-hover fade>
|
|
1400
|
+
<img src="logo-a.svg" alt="A">
|
|
1401
|
+
<img src="logo-b.svg" alt="B">
|
|
1402
|
+
</usa-marquee>
|
|
1403
|
+
```
|
|
1404
|
+
|
|
1405
|
+
### <usa-mask-reveal> — Mask reveal
|
|
1406
|
+
|
|
1407
|
+
Reveal images or sections through a growing mask: circle, diamond, star, iris or wipes, from any origin.
|
|
1408
|
+
|
|
1409
|
+
- Import: `import { defineMaskReveal } from 'motionary/components/svg'; defineMaskReveal();`
|
|
1410
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1411
|
+
- Events: `usa:complete`
|
|
1412
|
+
- Methods: `reveal()`
|
|
1413
|
+
|
|
1414
|
+
```html
|
|
1415
|
+
<usa-mask-reveal shape="circle" at="20% 30%">
|
|
1416
|
+
<img src="hero.jpg" alt="…">
|
|
1417
|
+
</usa-mask-reveal>
|
|
1418
|
+
```
|
|
1419
|
+
|
|
1420
|
+
### <usa-masonry> — Masonry
|
|
1421
|
+
|
|
1422
|
+
Pinterest-style masonry: items drop into the shortest column and glide when the width, the items or their sizes change. CSS columns before JS runs.
|
|
1423
|
+
|
|
1424
|
+
- Import: `import { defineMasonry } from 'motionary/components/layout'; defineMasonry();`
|
|
1425
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1426
|
+
- Attributes: `columns`, `min`, `gap`
|
|
1427
|
+
- Methods: `enable()`, `disable()`
|
|
1428
|
+
|
|
1429
|
+
```html
|
|
1430
|
+
<usa-masonry min="220" gap="16">
|
|
1431
|
+
<img src="1.jpg" alt="…">
|
|
1432
|
+
<img src="2.jpg" alt="…">
|
|
1433
|
+
</usa-masonry>
|
|
1434
|
+
```
|
|
1435
|
+
|
|
1436
|
+
### <usa-masonry-flow> — Masonry with layout animation
|
|
1437
|
+
|
|
1438
|
+
6.5: a masonry grid whose items glide to their new places (FLIP) on resize, insert / remove, filter(), shuffle() and sort(); hidden items scale out, new ones scale in.
|
|
1439
|
+
|
|
1440
|
+
- Import: `import { defineMasonryFlow } from 'motionary/components/widgets'; defineMasonryFlow();`
|
|
1441
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1442
|
+
- Attributes: `min`, `gap`
|
|
1443
|
+
- Events: `usa:layout`
|
|
1444
|
+
- Methods: `layout()`, `filter()`, `shuffle()`, `sort()`
|
|
1445
|
+
|
|
1446
|
+
```html
|
|
1447
|
+
<usa-masonry-flow min="160" gap="12">
|
|
1448
|
+
<img src="1.jpg" alt="…">
|
|
1449
|
+
<img src="2.jpg" alt="…">
|
|
1450
|
+
…
|
|
1451
|
+
</usa-masonry-flow>
|
|
1452
|
+
<!-- grid.filter('.cats'), grid.shuffle(), grid.sort((a, b) => …) -->
|
|
1453
|
+
```
|
|
1454
|
+
|
|
1455
|
+
### <usa-menu> — Dropdown menu
|
|
1456
|
+
|
|
1457
|
+
6.3: the list scales (or folds / slides) out of its button and the items cascade in. Full menu keyboard support — arrows, Home / End, Esc, Tab — and outside clicks close it.
|
|
1458
|
+
|
|
1459
|
+
- Import: `import { defineMenu } from 'motionary/components/widgets'; defineMenu();`
|
|
1460
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1461
|
+
- Attributes: `placement`, `effect`
|
|
1462
|
+
- Events: `usa:select`, `usa:open`, `usa:close`
|
|
1463
|
+
- Methods: `open()`, `close()`, `toggle()`
|
|
1464
|
+
|
|
1465
|
+
```html
|
|
1466
|
+
<usa-menu placement="bottom-start" effect="scale">
|
|
1467
|
+
<button>Actions ▾</button>
|
|
1468
|
+
<button>Edit</button>
|
|
1469
|
+
<button>Duplicate</button>
|
|
1470
|
+
<hr>
|
|
1471
|
+
<button>Delete</button>
|
|
1472
|
+
</usa-menu>
|
|
1473
|
+
```
|
|
1474
|
+
|
|
1475
|
+
### <usa-menu-toggle> — Hamburger → close
|
|
1476
|
+
|
|
1477
|
+
6.6: the three bars morph into a cross, a back arrow, a minus or a spinning plus-to-cross; a real toggle button with aria-expanded that can open the element it controls (for).
|
|
1478
|
+
|
|
1479
|
+
- Import: `import { defineMenuToggle } from 'motionary/components/widgets'; defineMenuToggle();`
|
|
1480
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1481
|
+
- Attributes: `variant`
|
|
1482
|
+
- Events: `usa:toggle`
|
|
1483
|
+
- Methods: `toggle()`
|
|
1484
|
+
|
|
1485
|
+
```html
|
|
1486
|
+
<usa-menu-toggle for="site-menu" variant="cross" label="Menu"></usa-menu-toggle>
|
|
1487
|
+
<nav id="site-menu" hidden>…</nav>
|
|
1488
|
+
```
|
|
1489
|
+
|
|
1490
|
+
### <usa-message-list> — Chat thread
|
|
1491
|
+
|
|
1492
|
+
7.4: a chat thread — new bubbles pop in from their side, consecutive messages group, the list sticks to the bottom (or shows a “↓ New messages” pill when you scrolled up) and typing(name) shows animated typing dots.
|
|
1493
|
+
|
|
1494
|
+
- Import: `import { defineMessageList } from 'motionary/components/widgets'; defineMessageList();`
|
|
1495
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1496
|
+
- Events: `usa:message`
|
|
1497
|
+
- Methods: `push()`, `typing()`
|
|
1498
|
+
|
|
1499
|
+
```html
|
|
1500
|
+
<usa-message-list>
|
|
1501
|
+
<p data-from="Ada">Hi! 👋</p>
|
|
1502
|
+
<p data-me>Hey Ada</p>
|
|
1503
|
+
</usa-message-list>
|
|
1504
|
+
<script>list.typing('Ada'); list.push({ from: 'Ada', text: 'Ship it?' });</script>
|
|
1505
|
+
```
|
|
1506
|
+
|
|
1507
|
+
### <usa-milestones> — Scroll-drawn milestones
|
|
1508
|
+
|
|
1509
|
+
6.5: a progress line grows down the rail as you scroll; each milestone pops its dot and slides its card in when the line reaches it. Alternating sides on wide screens, one column on phones; data-date labels.
|
|
1510
|
+
|
|
1511
|
+
- Import: `import { defineMilestones } from 'motionary/components/widgets'; defineMilestones();`
|
|
1512
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1513
|
+
- Attributes: `layout`
|
|
1514
|
+
- Events: `usa:reach`
|
|
1515
|
+
|
|
1516
|
+
```html
|
|
1517
|
+
<usa-milestones>
|
|
1518
|
+
<div data-date="2024"><h3>Idea</h3><p>…</p></div>
|
|
1519
|
+
<div data-date="2025"><h3>Beta</h3><p>…</p></div>
|
|
1520
|
+
<div data-date="2026"><h3>Launch</h3><p>…</p></div>
|
|
1521
|
+
</usa-milestones>
|
|
1522
|
+
```
|
|
1523
|
+
|
|
1524
|
+
### <usa-modal> — Modal dialog
|
|
1525
|
+
|
|
1526
|
+
6.3: native <dialog> (top layer, focus trap, Esc) with animated open / close and a blurred backdrop — scale, slide-up, flip, or origin: it grows out of the button that opened it. Focus returns to the opener.
|
|
1527
|
+
|
|
1528
|
+
- Import: `import { defineModal } from 'motionary/components/widgets'; defineModal();`
|
|
1529
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1530
|
+
|
|
1531
|
+
```html
|
|
1532
|
+
<button data-usa-open="welcome">Open</button>
|
|
1533
|
+
<usa-modal id="welcome" effect="origin" label="Welcome">
|
|
1534
|
+
<h2>Hello 👋</h2>
|
|
1535
|
+
<p>…</p>
|
|
1536
|
+
<button data-usa-close="ok">Got it</button>
|
|
1537
|
+
</usa-modal>
|
|
1538
|
+
```
|
|
1539
|
+
|
|
1540
|
+
### <usa-morph> — Path morph
|
|
1541
|
+
|
|
1542
|
+
Morph an SVG path through a list of shapes (paths="A | B | C") on click, hover, in view or automatically. Same-structure paths morph point by point.
|
|
1543
|
+
|
|
1544
|
+
- Import: `import { defineMorph } from 'motionary/components/svg'; defineMorph();`
|
|
1545
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1546
|
+
- Attributes: `paths`, `trigger`
|
|
1547
|
+
- Events: `usa:change`
|
|
1548
|
+
- Methods: `next()`
|
|
1549
|
+
|
|
1550
|
+
```html
|
|
1551
|
+
<usa-morph trigger="auto" interval="1800"
|
|
1552
|
+
paths="M50 10 C75 10 90 30 90 50 C90 75 70 90 50 90 C25 90 10 70 10 50 C10 30 25 10 50 10 Z | M50 4 C80 20 96 26 86 54 C78 84 64 96 44 86 C14 80 4 64 14 44 C20 20 30 0 50 4 Z"></usa-morph>
|
|
1553
|
+
```
|
|
1554
|
+
|
|
1555
|
+
### <usa-motion> — Motion DSL
|
|
1556
|
+
|
|
1557
|
+
9.0: the declarative motion DSL — describe motion as one readable string (“enter: fade-up 600ms stagger 80ms; hover: pop”) on <usa-motion> or any element’s data-motion, no JavaScript per element.
|
|
1558
|
+
|
|
1559
|
+
- Import: `import { defineMotion } from 'motionary/components/widgets'; defineMotion();`
|
|
1560
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1561
|
+
- Attributes: `rules`
|
|
1562
|
+
- Events: `usa:motion-error`
|
|
1563
|
+
|
|
1564
|
+
```html
|
|
1565
|
+
<usa-motion rules="enter: fade-up 600ms ease-out stagger 80ms; hover: pop">
|
|
1566
|
+
<div class="card">One</div><div class="card">Two</div><div class="card">Three</div>
|
|
1567
|
+
</usa-motion>
|
|
1568
|
+
|
|
1569
|
+
<!-- or on any element, with applyMotion() from motionary/dsl -->
|
|
1570
|
+
<section data-motion="enter: fade-up 500ms; click: confetti count=40">…</section>
|
|
1571
|
+
```
|
|
1572
|
+
|
|
1573
|
+
### <usa-motion-prefs> — Motion preference panel
|
|
1574
|
+
|
|
1575
|
+
9.5: a motion settings panel for your users — motion level (full, gentle, minimal, none), animation speed, pause autoplaying video, no parallax — applied instantly to every Motionary animation and remembered.
|
|
1576
|
+
|
|
1577
|
+
- Import: `import { defineMotionPrefs } from 'motionary/components/widgets'; defineMotionPrefs();`
|
|
1578
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1579
|
+
- Attributes: `label`
|
|
1580
|
+
- Events: `usa:change`
|
|
1581
|
+
- Methods: `reset()`
|
|
1582
|
+
|
|
1583
|
+
```html
|
|
1584
|
+
<usa-motion-prefs></usa-motion-prefs>
|
|
1585
|
+
```
|
|
1586
|
+
|
|
1587
|
+
### <usa-motion-spec> — Motion spec sheet
|
|
1588
|
+
|
|
1589
|
+
9.7: a motion spec sheet for design hand-off — each rule of a motion string with its trigger, a duration bar on a shared timeline and the easing curve, a Play playhead and Copy CSS; pairs with the Figma plugin and Framer export of motionary/design.
|
|
1590
|
+
|
|
1591
|
+
- Import: `import { defineMotionSpec } from 'motionary/components/widgets'; defineMotionSpec();`
|
|
1592
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1593
|
+
- Attributes: `rules`, `label`
|
|
1594
|
+
- Events: `usa:copy`
|
|
1595
|
+
- Methods: `play()`
|
|
1596
|
+
|
|
1597
|
+
```html
|
|
1598
|
+
<usa-motion-spec label="Card entrance" rules="enter: fade-up 600ms ease-out stagger 80ms; hover: pop 300ms spring"></usa-motion-spec>
|
|
1599
|
+
```
|
|
1600
|
+
|
|
1601
|
+
### <usa-motion-switch> — Motion intensity
|
|
1602
|
+
|
|
1603
|
+
Let users pick Off · Low · Normal · High for the whole app; scales every component, persists, and Off equals reduced motion.
|
|
1604
|
+
|
|
1605
|
+
- Import: `import { defineMotionSwitch } from 'motionary/components/page'; defineMotionSwitch();`
|
|
1606
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1607
|
+
- Events: `usa:change`
|
|
1608
|
+
|
|
1609
|
+
```html
|
|
1610
|
+
<usa-motion-switch></usa-motion-switch>
|
|
1611
|
+
<!-- or: setMotionIntensity('low', true) -->
|
|
1612
|
+
```
|
|
1613
|
+
|
|
1614
|
+
### <usa-motion-theme> — Theme packs
|
|
1615
|
+
|
|
1616
|
+
5.8: <usa-motion-theme name> applies a theme pack — design tokens (--usa-theme-*), motion tokens and effect presets per role (enter / hover / click / attention / background). Neon, paper, glass, retro and brutalist; applyMotionTheme() for the whole page.
|
|
1617
|
+
|
|
1618
|
+
- Import: `import { defineMotionTheme } from 'motionary/components/effects'; defineMotionTheme();`
|
|
1619
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1620
|
+
- Attributes: `name`
|
|
1621
|
+
|
|
1622
|
+
```html
|
|
1623
|
+
<usa-motion-theme name="neon">
|
|
1624
|
+
<div class="usa-surface">
|
|
1625
|
+
<button data-theme-fx="click">Tap</button>
|
|
1626
|
+
</div>
|
|
1627
|
+
</usa-motion-theme>
|
|
1628
|
+
```
|
|
1629
|
+
|
|
1630
|
+
### <usa-music-player> — Music player
|
|
1631
|
+
|
|
1632
|
+
7.1: the cover spins like a record while playing, play morphs to pause, mini equalizer bars dance and the progress bar is a scrubbable slider. Plays a child <audio> or simulates a track.
|
|
1633
|
+
|
|
1634
|
+
- Import: `import { defineMusicPlayer } from 'motionary/components/widgets'; defineMusicPlayer();`
|
|
1635
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1636
|
+
- Attributes: `title`, `artist`, `cover`, `src`
|
|
1637
|
+
- Events: `usa:play`, `usa:pause`, `usa:seek`
|
|
1638
|
+
- Methods: `play()`, `pause()`, `toggle()`, `seek()`
|
|
1639
|
+
|
|
1640
|
+
```html
|
|
1641
|
+
<usa-music-player title="Night Drive" artist="Motionary" cover="cover.jpg">
|
|
1642
|
+
<audio src="track.mp3"></audio>
|
|
1643
|
+
</usa-music-player>
|
|
1644
|
+
```
|
|
1645
|
+
|
|
1646
|
+
### <usa-native-preview> — Native preview
|
|
1647
|
+
|
|
1648
|
+
9.8: preview web motion as it will feel on a phone — an iOS / Android device frame replays the entrance with the rule’s curve and presses with a spring — and copy the generated React Native and Flutter code.
|
|
1649
|
+
|
|
1650
|
+
- Import: `import { defineNativePreview } from 'motionary/components/widgets'; defineNativePreview();`
|
|
1651
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1652
|
+
- Attributes: `rules`, `platform`, `name`
|
|
1653
|
+
- Events: `usa:replay`
|
|
1654
|
+
- Methods: `replay()`, `code()`
|
|
1655
|
+
|
|
1656
|
+
```html
|
|
1657
|
+
<usa-native-preview platform="ios" rules="enter: fade-up 500ms smooth stagger 80ms; click: pop">
|
|
1658
|
+
<div class="row">Inbox</div><div class="row">Starred</div>
|
|
1659
|
+
</usa-native-preview>
|
|
1660
|
+
```
|
|
1661
|
+
|
|
1662
|
+
### <usa-nav-morph> — Navbar with morphing indicator
|
|
1663
|
+
|
|
1664
|
+
6.6: the indicator follows the hovered or focused link — stretching from the old one, leading edge first — and settles back on the current page. Underline, pill, blob or dot.
|
|
1665
|
+
|
|
1666
|
+
- Import: `import { defineNavMorph } from 'motionary/components/widgets'; defineNavMorph();`
|
|
1667
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1668
|
+
- Attributes: `indicator`
|
|
1669
|
+
- Events: `usa:change`
|
|
1670
|
+
|
|
1671
|
+
```html
|
|
1672
|
+
<usa-nav-morph indicator="underline" label="Main">
|
|
1673
|
+
<a href="/" aria-current="page">Home</a>
|
|
1674
|
+
<a href="/docs">Docs</a>
|
|
1675
|
+
<a href="/blog">Blog</a>
|
|
1676
|
+
</usa-nav-morph>
|
|
1677
|
+
```
|
|
1678
|
+
|
|
1679
|
+
### <usa-navbar> — Auto-hide navbar
|
|
1680
|
+
|
|
1681
|
+
Hides while you scroll down, slides back on the first scroll up; shrink makes it compact once scrolled. This page’s demo scrolls an inner box.
|
|
1682
|
+
|
|
1683
|
+
- Import: `import { defineNavbar } from 'motionary/components/ui'; defineNavbar();`
|
|
1684
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1685
|
+
- Events: `usa:hide`, `usa:show`
|
|
1686
|
+
- Methods: `show()`
|
|
1687
|
+
|
|
1688
|
+
```html
|
|
1689
|
+
<usa-navbar shrink>
|
|
1690
|
+
<header>…</header>
|
|
1691
|
+
</usa-navbar>
|
|
1692
|
+
```
|
|
1693
|
+
|
|
1694
|
+
### <usa-notification-bell> — Notification bell
|
|
1695
|
+
|
|
1696
|
+
7.4: a bell with an unread badge and a dropdown — notify() swings the bell, bumps the badge and slides the notice in; “Mark all read” shrinks the badge away. Esc / outside click close it.
|
|
1697
|
+
|
|
1698
|
+
- Import: `import { defineNotificationBell } from 'motionary/components/widgets'; defineNotificationBell();`
|
|
1699
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1700
|
+
- Events: `usa:notify`, `usa:read`
|
|
1701
|
+
- Methods: `notify()`, `markAllRead()`, `ring()`
|
|
1702
|
+
|
|
1703
|
+
```html
|
|
1704
|
+
<usa-notification-bell>
|
|
1705
|
+
<li data-time="2m">Ada liked your post</li>
|
|
1706
|
+
</usa-notification-bell>
|
|
1707
|
+
<script>bell.notify({ text: 'New follower', time: 'now' });</script>
|
|
1708
|
+
```
|
|
1709
|
+
|
|
1710
|
+
### <usa-odometer> — Odometer counter
|
|
1711
|
+
|
|
1712
|
+
6.4: rolling digit wheels — every digit spins forward to its new value, new digits slide in, locale grouping via Intl.NumberFormat, decimals, prefix / suffix. The accessible name is the formatted number.
|
|
1713
|
+
|
|
1714
|
+
- Import: `import { defineOdometer } from 'motionary/components/widgets'; defineOdometer();`
|
|
1715
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1716
|
+
- Attributes: `value`, `locale`, `decimals`, `prefix`, `suffix`
|
|
1717
|
+
|
|
1718
|
+
```html
|
|
1719
|
+
<usa-odometer value="1284" locale="en-US" prefix="$"></usa-odometer>
|
|
1720
|
+
<!-- el.value = 2048 rolls every digit -->
|
|
1721
|
+
```
|
|
1722
|
+
|
|
1723
|
+
### <usa-organic-card> — Organic card
|
|
1724
|
+
|
|
1725
|
+
8.3: a card with a soft, living blob shape — its outline slowly breathes on screen, morphs on hover and comes in leaf, ocean, petal and sand tints.
|
|
1726
|
+
|
|
1727
|
+
- Import: `import { defineOrganicCard } from 'motionary/components/widgets'; defineOrganicCard();`
|
|
1728
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1729
|
+
- Attributes: `tint`, `seed`
|
|
1730
|
+
- Methods: `morph()`
|
|
1731
|
+
|
|
1732
|
+
```html
|
|
1733
|
+
<usa-organic-card tint="ocean">
|
|
1734
|
+
<h3>Deep sea</h3><p>Content…</p>
|
|
1735
|
+
</usa-organic-card>
|
|
1736
|
+
```
|
|
1737
|
+
|
|
1738
|
+
### <usa-otp> — OTP code input
|
|
1739
|
+
|
|
1740
|
+
7.7: one-time-code boxes that auto-advance, step back on Backspace and take a pasted code; digits pop in, error() shakes the row red, success() sends a green wave across it.
|
|
1741
|
+
|
|
1742
|
+
- Import: `import { defineOtp } from 'motionary/components/widgets'; defineOtp();`
|
|
1743
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1744
|
+
- Attributes: `length`, `mode`, `label`
|
|
1745
|
+
- Events: `usa:complete`
|
|
1746
|
+
- Methods: `fillCode()`, `clear()`, `error()`, `success()`
|
|
1747
|
+
|
|
1748
|
+
```html
|
|
1749
|
+
<usa-otp length="6"></usa-otp>
|
|
1750
|
+
<script>otp.addEventListener('usa:complete', (e) => check(e.detail.code) ? otp.success() : otp.error());</script>
|
|
1751
|
+
```
|
|
1752
|
+
|
|
1753
|
+
### <usa-overscroll> — Elastic overscroll
|
|
1754
|
+
|
|
1755
|
+
A scroll container whose edges stretch with iOS-style rubber-band resistance and spring back — touch, trackpad and wheel.
|
|
1756
|
+
|
|
1757
|
+
- Import: `import { defineOverscroll } from 'motionary/components/physics'; defineOverscroll();`
|
|
1758
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1759
|
+
- Attributes: `axis`, `disabled`
|
|
1760
|
+
|
|
1761
|
+
```html
|
|
1762
|
+
<usa-overscroll style="height: 240px">
|
|
1763
|
+
<ul>…</ul>
|
|
1764
|
+
</usa-overscroll>
|
|
1765
|
+
```
|
|
1766
|
+
|
|
1767
|
+
### <usa-pack> — E-commerce pack
|
|
1768
|
+
|
|
1769
|
+
Product cards reveal and lift, “Add to cart” presses and flies the product into the cart (which bumps), prices count up, badges pulse.
|
|
1770
|
+
|
|
1771
|
+
- Import: `import { definePack } from 'motionary/components/packs'; definePack();`
|
|
1772
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1773
|
+
- Attributes: `name`
|
|
1774
|
+
|
|
1775
|
+
```html
|
|
1776
|
+
<usa-pack name="ecommerce">
|
|
1777
|
+
<article data-role="product">
|
|
1778
|
+
<img src="shoe.jpg" alt="Runner">
|
|
1779
|
+
<span data-role="price">$129</span>
|
|
1780
|
+
<button data-role="add-to-cart">Add to cart</button>
|
|
1781
|
+
</article>
|
|
1782
|
+
<a data-role="cart" href="/cart">Cart</a>
|
|
1783
|
+
</usa-pack>
|
|
1784
|
+
```
|
|
1785
|
+
|
|
1786
|
+
### <usa-pagination> — Pagination with sliding ink
|
|
1787
|
+
|
|
1788
|
+
6.7: the highlight springs to the chosen page (squashing on the way) and page numbers slide in from the direction of travel when the window shifts. Prev / next, ellipses, aria-current.
|
|
1789
|
+
|
|
1790
|
+
- Import: `import { definePagination } from 'motionary/components/widgets'; definePagination();`
|
|
1791
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1792
|
+
- Attributes: `total`, `siblings`
|
|
1793
|
+
- Events: `usa:change`
|
|
1794
|
+
|
|
1795
|
+
```html
|
|
1796
|
+
<usa-pagination total="20" page="1" siblings="1"></usa-pagination>
|
|
1797
|
+
```
|
|
1798
|
+
|
|
1799
|
+
### <usa-panorama> — 360° panorama viewer
|
|
1800
|
+
|
|
1801
|
+
8.8: a 360° panorama — drag or swipe to look around with inertia, a slow auto-rotate, a compass for the heading and a “View in XR” badge when the browser offers WebXR.
|
|
1802
|
+
|
|
1803
|
+
- Import: `import { definePanorama } from 'motionary/components/widgets'; definePanorama();`
|
|
1804
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1805
|
+
- Attributes: `src`, `autorotate`, `label`
|
|
1806
|
+
- Events: `usa:xr`, `usa:xr-request`, `usa:look`
|
|
1807
|
+
- Methods: `lookAt()`
|
|
1808
|
+
|
|
1809
|
+
```html
|
|
1810
|
+
<usa-panorama src="pano-equirect.jpg" label="Lake at dawn" autorotate="6"></usa-panorama>
|
|
1811
|
+
```
|
|
1812
|
+
|
|
1813
|
+
### <usa-particles> — Particles
|
|
1814
|
+
|
|
1815
|
+
A canvas constellation that drifts away from the pointer. Runs only while visible, DPR ≤ 2, a still frame under reduced motion.
|
|
1816
|
+
|
|
1817
|
+
- Import: `import { defineParticles } from 'motionary/components/background'; defineParticles();`
|
|
1818
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1819
|
+
- Attributes: `count`, `color`, `size`, `speed`, `links`, `interactive`, `paused`
|
|
1820
|
+
- Methods: `reset()`
|
|
1821
|
+
|
|
1822
|
+
```html
|
|
1823
|
+
<usa-particles count="80" links="120" interactive></usa-particles>
|
|
1824
|
+
```
|
|
1825
|
+
|
|
1826
|
+
### <usa-pause-all> — Pause all motion
|
|
1827
|
+
|
|
1828
|
+
9.5: one button that pauses all motion on the page (WCAG 2.2.2) — Motionary’s shared clock, every CSS / Web animation and autoplaying media — and resumes it again; `scope` limits it to one area.
|
|
1829
|
+
|
|
1830
|
+
- Import: `import { definePauseAll } from 'motionary/components/widgets'; definePauseAll();`
|
|
1831
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1832
|
+
- Attributes: `label`, `scope`, `resume-label`
|
|
1833
|
+
- Events: `usa:pause-all`
|
|
1834
|
+
- Methods: `toggle()`
|
|
1835
|
+
|
|
1836
|
+
```html
|
|
1837
|
+
<usa-pause-all></usa-pause-all>
|
|
1838
|
+
```
|
|
1839
|
+
|
|
1840
|
+
### <usa-perf-monitor> — Perf monitor
|
|
1841
|
+
|
|
1842
|
+
9.6: a live performance overlay for motion work — FPS with a sparkline, active Motionary animations, frame-loop callbacks, long tasks and the shared clock — flagging jank.
|
|
1843
|
+
|
|
1844
|
+
- Import: `import { definePerfMonitor } from 'motionary/components/widgets'; definePerfMonitor();`
|
|
1845
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1846
|
+
- Attributes: `corner`, `warn`
|
|
1847
|
+
- Events: `usa:jank`
|
|
1848
|
+
|
|
1849
|
+
```html
|
|
1850
|
+
<usa-perf-monitor corner="bottom-right"></usa-perf-monitor>
|
|
1851
|
+
```
|
|
1852
|
+
|
|
1853
|
+
### <usa-pinch-zoom> — Pinch zoom
|
|
1854
|
+
|
|
1855
|
+
Pinch with two fingers or Ctrl + wheel / trackpad pinch, pan while zoomed, double-tap to toggle; scale and position spring back inside the bounds.
|
|
1856
|
+
|
|
1857
|
+
- Import: `import { definePinchZoom } from 'motionary/components/gesture'; definePinchZoom();`
|
|
1858
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1859
|
+
- Events: `usa:zoom`
|
|
1860
|
+
- Methods: `zoomTo()`
|
|
1861
|
+
|
|
1862
|
+
```html
|
|
1863
|
+
<usa-pinch-zoom max="4">
|
|
1864
|
+
<img src="photo.jpg" alt="…">
|
|
1865
|
+
</usa-pinch-zoom>
|
|
1866
|
+
```
|
|
1867
|
+
|
|
1868
|
+
### <usa-player> — JSON animation player
|
|
1869
|
+
|
|
1870
|
+
5.9: <usa-player> plays a JSON animation — timeline presets, your own keyframes and any registered effect on a shared clock; play / pause / seek / rate / loop, scroll-scrubbing (trigger="scroll"). Export one from the Playground (<usa-player> JSON tab).
|
|
1871
|
+
|
|
1872
|
+
- Import: `import { definePlayer } from 'motionary/components/effects'; definePlayer();`
|
|
1873
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1874
|
+
- Attributes: `src`, `trigger`, `loop`, `rate`
|
|
1875
|
+
- Methods: `load()`, `play()`, `pause()`, `seek()`
|
|
1876
|
+
|
|
1877
|
+
```html
|
|
1878
|
+
<usa-player src="hero.json" trigger="view">
|
|
1879
|
+
<h1>Title</h1>
|
|
1880
|
+
<a class="cta">Start</a>
|
|
1881
|
+
</usa-player>
|
|
1882
|
+
```
|
|
1883
|
+
|
|
1884
|
+
### <usa-plugin-card> — Plugin detail card
|
|
1885
|
+
|
|
1886
|
+
10.1: a plugin’s name, version and author with a Motionary compatibility badge (semver `engine` range), a signature badge (SHA-256 integrity checked with Web Crypto), an animated download counter and expandable details. Requires motionary/runtime — npm i motionary, then use() before the card mounts.
|
|
1887
|
+
|
|
1888
|
+
- Import: `import { definePluginCard } from 'motionary/components/widgets'; definePluginCard();`
|
|
1889
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1890
|
+
- Attributes: `name`, `title`, `version`, `author`, `engine`, `downloads`, `integrity`, `src`
|
|
1891
|
+
- Events: `usa:toggle`, `usa:verified`, `usa:runtime-missing`
|
|
1892
|
+
- Methods: `toggle()`, `verify()`, `compat()`
|
|
1893
|
+
- Requires: motionary/runtime
|
|
1894
|
+
- Install: `npm i motionary`
|
|
1895
|
+
- Order: Import motionary/runtime and call use() once at start-up, before any runtime-powered component mounts. CDN: the IIFE registers itself (window.MotionaryRuntime).
|
|
1896
|
+
|
|
1897
|
+
```js
|
|
1898
|
+
import { use } from 'motionary/runtime';
|
|
1899
|
+
import { definePluginCard } from 'motionary/components/widgets';
|
|
1900
|
+
|
|
1901
|
+
use();
|
|
1902
|
+
definePluginCard(); // registers <usa-plugin-card> — after the prerequisites
|
|
1903
|
+
```
|
|
1904
|
+
|
|
1905
|
+
```html
|
|
1906
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
|
|
1907
|
+
<!-- then the component bundles -->
|
|
1908
|
+
<script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>
|
|
1909
|
+
<script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>
|
|
1910
|
+
```
|
|
1911
|
+
|
|
1912
|
+
```html
|
|
1913
|
+
<usa-plugin-card name="retro" title="Retro" version="1.2.0" author="Motionary" engine="^10.0.0" downloads="12400">
|
|
1914
|
+
<p>Pixel, CRT, VHS and Y2K effects.</p>
|
|
1915
|
+
</usa-plugin-card>
|
|
1916
|
+
```
|
|
1917
|
+
|
|
1918
|
+
### <usa-plugin-store> — Plugin marketplace
|
|
1919
|
+
|
|
1920
|
+
9.0: the plugin marketplace as a component — search the catalogue of effect packs, see each plugin’s effects and install it with one click (imports and registers the pack).
|
|
1921
|
+
|
|
1922
|
+
- Import: `import { definePluginStore } from 'motionary/components/widgets'; definePluginStore();`
|
|
1923
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1924
|
+
- Attributes: `query`, `label`
|
|
1925
|
+
- Events: `usa:install`, `usa:install-error`
|
|
1926
|
+
- Methods: `search()`, `install()`
|
|
1927
|
+
|
|
1928
|
+
```html
|
|
1929
|
+
<usa-plugin-store query="neon"></usa-plugin-store>
|
|
1930
|
+
<script type="module">
|
|
1931
|
+
const store = document.querySelector('usa-plugin-store');
|
|
1932
|
+
store.loader = (entry) => import(entry); // or map to your bundler imports
|
|
1933
|
+
</script>
|
|
1934
|
+
```
|
|
1935
|
+
|
|
1936
|
+
### <usa-popover> — Popover
|
|
1937
|
+
|
|
1938
|
+
Click-to-open panel that springs from its trigger; Esc / outside click closes, focus returns.
|
|
1939
|
+
|
|
1940
|
+
- Import: `import { definePopover } from 'motionary/components/ui'; definePopover();`
|
|
1941
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1942
|
+
- Methods: `toggle()`
|
|
1943
|
+
|
|
1944
|
+
```html
|
|
1945
|
+
<usa-popover>
|
|
1946
|
+
<button>Share</button>
|
|
1947
|
+
<div data-popover>…</div>
|
|
1948
|
+
</usa-popover>
|
|
1949
|
+
```
|
|
1950
|
+
|
|
1951
|
+
### <usa-post-fx> — Post-processing
|
|
1952
|
+
|
|
1953
|
+
Chainable GPU passes over an image (4.8): vignette, grain, chromatic aberration, scanlines, CRT, bloom, pixelate, duotone and glitch, with one intensity. Without WebGL the image gets an approximate CSS filter.
|
|
1954
|
+
|
|
1955
|
+
- Import: `import { definePostFx } from 'motionary/components/webgl'; definePostFx();`
|
|
1956
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1957
|
+
|
|
1958
|
+
```html
|
|
1959
|
+
<usa-post-fx effects="vignette grain" intensity="0.6">
|
|
1960
|
+
<img src="photo.jpg" alt="…">
|
|
1961
|
+
</usa-post-fx>
|
|
1962
|
+
```
|
|
1963
|
+
|
|
1964
|
+
### <usa-presence> — Presence avatar
|
|
1965
|
+
|
|
1966
|
+
7.4: an avatar with a live status dot (online, away, busy, offline) — coming online sends a ripple, speaking adds a pulsing ring and story an animated gradient ring. Initials when there is no photo.
|
|
1967
|
+
|
|
1968
|
+
- Import: `import { definePresence } from 'motionary/components/widgets'; definePresence();`
|
|
1969
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1970
|
+
- Attributes: `status`, `speaking`, `name`, `src`
|
|
1971
|
+
|
|
1972
|
+
```html
|
|
1973
|
+
<usa-presence name="Ada Lovelace" status="online"></usa-presence>
|
|
1974
|
+
<usa-presence name="Alan Turing" status="away" speaking></usa-presence>
|
|
1975
|
+
<usa-presence name="Grace Hopper" status="busy" story></usa-presence>
|
|
1976
|
+
```
|
|
1977
|
+
|
|
1978
|
+
### <usa-press> — Press feedback
|
|
1979
|
+
|
|
1980
|
+
Tactile press: dips while pressed and springs back, or bounces once with bounce. Mouse, touch, pen and keyboard.
|
|
1981
|
+
|
|
1982
|
+
- Import: `import { definePress } from 'motionary/components/interaction'; definePress();`
|
|
1983
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
1984
|
+
- Attributes: `disabled`
|
|
1985
|
+
|
|
1986
|
+
```html
|
|
1987
|
+
<usa-press bounce><button>Press</button></usa-press>
|
|
1988
|
+
```
|
|
1989
|
+
|
|
1990
|
+
### <usa-prize-wheel> — Prize wheel
|
|
1991
|
+
|
|
1992
|
+
7.5: a lottery wheel — Spin whirls it and it eases out on the result (random or spin(index)), the pointer ticks and the wheel glows; usa:result reports the prize.
|
|
1993
|
+
|
|
1994
|
+
- Import: `import { definePrizeWheel } from 'motionary/components/widgets'; definePrizeWheel();`
|
|
1995
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
1996
|
+
- Events: `usa:result`
|
|
1997
|
+
- Methods: `spin()`
|
|
1998
|
+
|
|
1999
|
+
```html
|
|
2000
|
+
<usa-prize-wheel segments="10% off,Free ship,Try again,🎁 Gift,5% off,Jackpot"></usa-prize-wheel>
|
|
2001
|
+
```
|
|
2002
|
+
|
|
2003
|
+
### <usa-product-gallery> — Product gallery
|
|
2004
|
+
|
|
2005
|
+
7.3: product photos with a thumbnail strip — the stage cross-slides in the direction of travel, the selection ring glides between thumbnails, hover zooms under the pointer, swipe and ←/→ work.
|
|
2006
|
+
|
|
2007
|
+
- Import: `import { defineProductGallery } from 'motionary/components/widgets'; defineProductGallery();`
|
|
2008
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2009
|
+
- Attributes: `index`
|
|
2010
|
+
- Events: `usa:change`
|
|
2011
|
+
- Methods: `go()`, `next()`, `prev()`
|
|
2012
|
+
|
|
2013
|
+
```html
|
|
2014
|
+
<usa-product-gallery zoom="2">
|
|
2015
|
+
<img src="front.jpg" alt="Front">
|
|
2016
|
+
<img src="side.jpg" alt="Side">
|
|
2017
|
+
<img src="back.jpg" alt="Back">
|
|
2018
|
+
</usa-product-gallery>
|
|
2019
|
+
```
|
|
2020
|
+
|
|
2021
|
+
### <usa-progress> — Progress bar
|
|
2022
|
+
|
|
2023
|
+
Determinate bars glide between values; without a value it shows the Fluent indeterminate animation. Paused / error states.
|
|
2024
|
+
|
|
2025
|
+
- Import: `import { defineProgress } from 'motionary/components/feedback'; defineProgress();`
|
|
2026
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2027
|
+
- Attributes: `value`, `max`, `indeterminate`, `label`
|
|
2028
|
+
- Events: `usa:complete`
|
|
2029
|
+
|
|
2030
|
+
```html
|
|
2031
|
+
<usa-progress value="40"></usa-progress>
|
|
2032
|
+
<usa-progress indeterminate></usa-progress>
|
|
2033
|
+
```
|
|
2034
|
+
|
|
2035
|
+
### <usa-progress-ring> — Progress ring / bar / gauge
|
|
2036
|
+
|
|
2037
|
+
6.4: the arc eases to every new value with a little overshoot while the label counts up; ring, bar or semicircle gauge, gradient strokes, indeterminate spinner without a value. role="progressbar", usa:complete at 100%.
|
|
2038
|
+
|
|
2039
|
+
- Import: `import { defineProgressRing } from 'motionary/components/widgets'; defineProgressRing();`
|
|
2040
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2041
|
+
- Attributes: `variant`, `value`, `max`, `gradient`
|
|
2042
|
+
- Events: `usa:complete`
|
|
2043
|
+
|
|
2044
|
+
```html
|
|
2045
|
+
<usa-progress-ring value="72" gradient="#7c5cff,#22d3ee"></usa-progress-ring>
|
|
2046
|
+
<usa-progress-ring variant="bar" value="40"></usa-progress-ring>
|
|
2047
|
+
<usa-progress-ring variant="semi" value="88"></usa-progress-ring>
|
|
2048
|
+
<!-- el.value = 90 animates to the new value -->
|
|
2049
|
+
```
|
|
2050
|
+
|
|
2051
|
+
### <usa-prop-panel> — Property panel
|
|
2052
|
+
|
|
2053
|
+
8.9 low-code: a property editor for a live component — typed fields (number / range, select, color, switch, text) bound to its attributes, so the component re-renders as you edit.
|
|
2054
|
+
|
|
2055
|
+
- Import: `import { definePropPanel } from 'motionary/components/widgets'; definePropPanel();`
|
|
2056
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2057
|
+
- Attributes: `for`, `props`, `label`
|
|
2058
|
+
- Events: `usa:prop`
|
|
2059
|
+
- Methods: `reset()`
|
|
2060
|
+
|
|
2061
|
+
```html
|
|
2062
|
+
<usa-star-rating id="r" value="3"></usa-star-rating>
|
|
2063
|
+
<usa-prop-panel for="#r" props="value:number:0:5, icon:select:star|heart, readonly:boolean"></usa-prop-panel>
|
|
2064
|
+
```
|
|
2065
|
+
|
|
2066
|
+
### <usa-pull-cord> — Lamp pull-cord switch
|
|
2067
|
+
|
|
2068
|
+
6.8: pull the cord down and let go — past the threshold the lamp switches, and the cord swings back on a damped spring. Click, Space or Enter tug it too; role="switch".
|
|
2069
|
+
|
|
2070
|
+
- Import: `import { definePullCord } from 'motionary/components/widgets'; definePullCord();`
|
|
2071
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2072
|
+
- Events: `usa:change`
|
|
2073
|
+
- Methods: `toggle()`
|
|
2074
|
+
|
|
2075
|
+
```html
|
|
2076
|
+
<usa-pull-cord label="Desk lamp"></usa-pull-cord>
|
|
2077
|
+
```
|
|
2078
|
+
|
|
2079
|
+
### <usa-pull-refresh> — Pull to refresh
|
|
2080
|
+
|
|
2081
|
+
Pull down at the top of a list: the spinner stretches in with rubber-band resistance; release past the threshold to refresh.
|
|
2082
|
+
|
|
2083
|
+
- Import: `import { definePullRefresh } from 'motionary/components/ui'; definePullRefresh();`
|
|
2084
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2085
|
+
- Methods: `refresh()`
|
|
2086
|
+
|
|
2087
|
+
```html
|
|
2088
|
+
<usa-pull-refresh style="height: 300px">
|
|
2089
|
+
<ul>…</ul>
|
|
2090
|
+
</usa-pull-refresh>
|
|
2091
|
+
<script>el.addEventListener('usa:refresh', async (e) => { await load(); e.detail.done(); });</script>
|
|
2092
|
+
```
|
|
2093
|
+
|
|
2094
|
+
### <usa-radar> — Radar scope
|
|
2095
|
+
|
|
2096
|
+
8.4: a sci-fi radar scope — a conic beam sweeps round and each target lights up and fades as the beam passes over it.
|
|
2097
|
+
|
|
2098
|
+
- Import: `import { defineRadar } from 'motionary/components/widgets'; defineRadar();`
|
|
2099
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2100
|
+
- Attributes: `targets`, `rings`, `speed`, `label`
|
|
2101
|
+
- Events: `usa:ping`
|
|
2102
|
+
- Methods: `setTargets()`
|
|
2103
|
+
|
|
2104
|
+
```html
|
|
2105
|
+
<usa-radar targets="Alpha:40,0.6; Bravo:200,0.35; Echo:300,0.8" speed="4"></usa-radar>
|
|
2106
|
+
```
|
|
2107
|
+
|
|
2108
|
+
### <usa-reactions> — Emoji reactions
|
|
2109
|
+
|
|
2110
|
+
7.4: a reaction bar — clicking a pill toggles your reaction: the emoji pops, the count rolls and copies float up; + springs open a picker. Each pill is a toggle button with a count label.
|
|
2111
|
+
|
|
2112
|
+
- Import: `import { defineReactions } from 'motionary/components/widgets'; defineReactions();`
|
|
2113
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2114
|
+
- Events: `usa:react`
|
|
2115
|
+
- Methods: `toggle()`
|
|
2116
|
+
|
|
2117
|
+
```html
|
|
2118
|
+
<usa-reactions emojis="👍,❤️,😂,🎉" counts="3,1,0,2"></usa-reactions>
|
|
2119
|
+
```
|
|
2120
|
+
|
|
2121
|
+
### <usa-red-envelope> — Red envelope (红包)
|
|
2122
|
+
|
|
2123
|
+
8.1: a Lunar New Year red envelope — tap and the flap swings open, the card slides out with the amount counting up and gold coins pop out.
|
|
2124
|
+
|
|
2125
|
+
- Import: `import { defineRedEnvelope } from 'motionary/components/widgets'; defineRedEnvelope();`
|
|
2126
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2127
|
+
- Attributes: `amount`, `currency`, `message`, `from`
|
|
2128
|
+
- Events: `usa:open`
|
|
2129
|
+
- Methods: `open()`, `close()`
|
|
2130
|
+
|
|
2131
|
+
```html
|
|
2132
|
+
<usa-red-envelope amount="88.88" from="Grandma" message="恭喜发财"></usa-red-envelope>
|
|
2133
|
+
```
|
|
2134
|
+
|
|
2135
|
+
### <usa-retro-button> — Retro buttons
|
|
2136
|
+
|
|
2137
|
+
8.2: buttons in four eras with matching press motion — 8-bit pixel (stepped press), CRT phosphor (flicker), Y2K chrome pill (bounce) and Windows 95 bevel (sink).
|
|
2138
|
+
|
|
2139
|
+
- Import: `import { defineRetroButton } from 'motionary/components/widgets'; defineRetroButton();`
|
|
2140
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2141
|
+
- Attributes: `variant`, `disabled`
|
|
2142
|
+
|
|
2143
|
+
```html
|
|
2144
|
+
<usa-retro-button variant="pixel">Start</usa-retro-button>
|
|
2145
|
+
<usa-retro-button variant="win95">OK</usa-retro-button>
|
|
2146
|
+
```
|
|
2147
|
+
|
|
2148
|
+
### <usa-reveal> — Reveal
|
|
2149
|
+
|
|
2150
|
+
Fade, slide, zoom, blur or flip content in as it enters the viewport. 12 effects, replay on re-entry with repeat.
|
|
2151
|
+
|
|
2152
|
+
- Import: `import { defineReveal } from 'motionary/components/reveal'; defineReveal();`
|
|
2153
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2154
|
+
- Attributes: `effect`, `distance`, `repeat`, `threshold`, `root-margin`
|
|
2155
|
+
- Events: `usa:enter`, `usa:leave`, `usa:complete`
|
|
2156
|
+
- Methods: `reveal()`, `reset()`
|
|
2157
|
+
|
|
2158
|
+
```html
|
|
2159
|
+
<usa-reveal effect="fade-up" duration="700">
|
|
2160
|
+
<h2>Hello</h2>
|
|
2161
|
+
</usa-reveal>
|
|
2162
|
+
```
|
|
2163
|
+
|
|
2164
|
+
### <usa-ripple> — Ripple
|
|
2165
|
+
|
|
2166
|
+
Ink ripple from the pointer — or from the centre for Space/Enter — on any button, list item or card.
|
|
2167
|
+
|
|
2168
|
+
- Import: `import { defineRipple } from 'motionary/components/interaction'; defineRipple();`
|
|
2169
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2170
|
+
- Methods: `ripple()`
|
|
2171
|
+
|
|
2172
|
+
```html
|
|
2173
|
+
<usa-ripple><button>Click me</button></usa-ripple>
|
|
2174
|
+
```
|
|
2175
|
+
|
|
2176
|
+
### <usa-scene> — Cinematic scene
|
|
2177
|
+
|
|
2178
|
+
9.1: a scroll-scrubbed cinematic shot — while the scene crosses the screen its image follows a camera move (dolly, pan, tilt, zoom, orbit) and captions fade in on cue.
|
|
2179
|
+
|
|
2180
|
+
- Import: `import { defineScene } from 'motionary/components/widgets'; defineScene();`
|
|
2181
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2182
|
+
- Attributes: `camera`, `strength`, `autoplay`
|
|
2183
|
+
- Events: `usa:shot`
|
|
2184
|
+
- Methods: `setProgress()`
|
|
2185
|
+
|
|
2186
|
+
```html
|
|
2187
|
+
<usa-scene camera="dolly-in">
|
|
2188
|
+
<img src="harbor.jpg" alt="Harbor at dawn">
|
|
2189
|
+
<p data-caption data-at="0.4">Dawn, 1912.</p>
|
|
2190
|
+
</usa-scene>
|
|
2191
|
+
```
|
|
2192
|
+
|
|
2193
|
+
### <usa-scramble> — Scramble / decode
|
|
2194
|
+
|
|
2195
|
+
Decodes text out of random glyphs, left to right. Trigger on view, hover/focus or manually.
|
|
2196
|
+
|
|
2197
|
+
- Import: `import { defineScramble } from 'motionary/components/text'; defineScramble();`
|
|
2198
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2199
|
+
- Attributes: `text`
|
|
2200
|
+
- Events: `usa:complete`
|
|
2201
|
+
- Methods: `play()`
|
|
2202
|
+
|
|
2203
|
+
```html
|
|
2204
|
+
<usa-scramble trigger="hover">ACCESS GRANTED</usa-scramble>
|
|
2205
|
+
```
|
|
2206
|
+
|
|
2207
|
+
### <usa-scroll-highlight> — Scroll highlight
|
|
2208
|
+
|
|
2209
|
+
Words light up one by one as you read down the page, or a highlighter marker sweeps behind the text.
|
|
2210
|
+
|
|
2211
|
+
- Import: `import { defineScrollHighlight } from 'motionary/components/text'; defineScrollHighlight();`
|
|
2212
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2213
|
+
- Attributes: `mode`, `text`
|
|
2214
|
+
- Methods: `mount()`
|
|
2215
|
+
|
|
2216
|
+
```html
|
|
2217
|
+
<usa-scroll-highlight>Every word lights up as you scroll.</usa-scroll-highlight>
|
|
2218
|
+
<usa-scroll-highlight mode="marker">Important</usa-scroll-highlight>
|
|
2219
|
+
```
|
|
2220
|
+
|
|
2221
|
+
### <usa-scroll-progress> — Scroll progress bar
|
|
2222
|
+
|
|
2223
|
+
Reading progress of the page or of one article. Compositor-only scaleX, role="progressbar".
|
|
2224
|
+
|
|
2225
|
+
- Import: `import { defineScrollProgress } from 'motionary/components/reveal'; defineScrollProgress();`
|
|
2226
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2227
|
+
- Attributes: `target`, `label`
|
|
2228
|
+
- Events: `usa:progress`
|
|
2229
|
+
- Methods: `update()`
|
|
2230
|
+
|
|
2231
|
+
```html
|
|
2232
|
+
<usa-scroll-progress></usa-scroll-progress>
|
|
2233
|
+
<!-- or for one article -->
|
|
2234
|
+
<usa-scroll-progress target="#post" position="bottom"></usa-scroll-progress>
|
|
2235
|
+
```
|
|
2236
|
+
|
|
2237
|
+
### <usa-scrolly> — Sticky scrollytelling
|
|
2238
|
+
|
|
2239
|
+
A pinned graphic while [data-step] blocks scroll past; the active step drives the graphic via attributes, a CSS variable and events.
|
|
2240
|
+
|
|
2241
|
+
- Import: `import { defineScrolly } from 'motionary/components/reveal'; defineScrolly();`
|
|
2242
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2243
|
+
- Attributes: `offset`
|
|
2244
|
+
- Events: `usa:step`
|
|
2245
|
+
|
|
2246
|
+
```html
|
|
2247
|
+
<usa-scrolly>
|
|
2248
|
+
<figure data-sticky>…</figure>
|
|
2249
|
+
<section data-step="intro">…</section>
|
|
2250
|
+
<section data-step="detail">…</section>
|
|
2251
|
+
</usa-scrolly>
|
|
2252
|
+
```
|
|
2253
|
+
|
|
2254
|
+
### <usa-segmented> — Segmented control
|
|
2255
|
+
|
|
2256
|
+
6.7: an iOS-style thumb slides under the chosen segment with a spring and stretches while it travels. A real radio group: arrow keys, Home / End. iOS, pill or outline.
|
|
2257
|
+
|
|
2258
|
+
- Import: `import { defineSegmented } from 'motionary/components/widgets'; defineSegmented();`
|
|
2259
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2260
|
+
- Attributes: `variant`
|
|
2261
|
+
- Events: `usa:change`
|
|
2262
|
+
|
|
2263
|
+
```html
|
|
2264
|
+
<usa-segmented variant="ios" label="View">
|
|
2265
|
+
<button>Day</button>
|
|
2266
|
+
<button>Week</button>
|
|
2267
|
+
<button>Month</button>
|
|
2268
|
+
</usa-segmented>
|
|
2269
|
+
```
|
|
2270
|
+
|
|
2271
|
+
### <usa-shader> — Shader background
|
|
2272
|
+
|
|
2273
|
+
A GPU shader behind your content: gradient, plasma, waves or aurora presets — or your own fragment shader in a <script type="x-shader/x-fragment">. Falls back to the CSS background.
|
|
2274
|
+
|
|
2275
|
+
- Import: `import { defineShader } from 'motionary/components/webgl'; defineShader();`
|
|
2276
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2277
|
+
|
|
2278
|
+
```html
|
|
2279
|
+
<usa-shader preset="aurora" speed="1">
|
|
2280
|
+
<h1>Hero title</h1>
|
|
2281
|
+
</usa-shader>
|
|
2282
|
+
|
|
2283
|
+
<usa-shader>
|
|
2284
|
+
<script type="x-shader/x-fragment">
|
|
2285
|
+
void main() { gl_FragColor = vec4(v_uv, 0.5 + 0.5 * sin(u_time), 1.0); }
|
|
2286
|
+
</script>
|
|
2287
|
+
</usa-shader>
|
|
2288
|
+
```
|
|
2289
|
+
|
|
2290
|
+
### <usa-sheet> — Drawer / bottom sheet
|
|
2291
|
+
|
|
2292
|
+
6.3: a side sheet from the right, left, top or bottom with a blurred backdrop; the bottom sheet can be dragged down to dismiss and springs back otherwise. Native <dialog> underneath.
|
|
2293
|
+
|
|
2294
|
+
- Import: `import { defineSheet } from 'motionary/components/widgets'; defineSheet();`
|
|
2295
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2296
|
+
|
|
2297
|
+
```html
|
|
2298
|
+
<button data-usa-open="cart">Cart</button>
|
|
2299
|
+
<usa-sheet id="cart" side="right" label="Cart">
|
|
2300
|
+
<h2>Your cart</h2>
|
|
2301
|
+
…
|
|
2302
|
+
<button data-usa-close>Close</button>
|
|
2303
|
+
</usa-sheet>
|
|
2304
|
+
```
|
|
2305
|
+
|
|
2306
|
+
### <usa-shimmer-text> — Shimmer text
|
|
2307
|
+
|
|
2308
|
+
A light sweep across gradient-filled text. CSS only; colours and speed via attributes or custom properties.
|
|
2309
|
+
|
|
2310
|
+
- Import: `import { defineShimmerText } from 'motionary/components/text'; defineShimmerText();`
|
|
2311
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2312
|
+
- Attributes: `duration`, `color`, `shine`, `angle`
|
|
2313
|
+
|
|
2314
|
+
```html
|
|
2315
|
+
<usa-shimmer-text shine="#fff">Premium</usa-shimmer-text>
|
|
2316
|
+
```
|
|
2317
|
+
|
|
2318
|
+
### <usa-shortcut> — Shortcut hint
|
|
2319
|
+
|
|
2320
|
+
7.9: keyboard-shortcut hints as keycaps (⌘ on Apple, Ctrl elsewhere); press the combination anywhere and the caps press down one after another and usa:trigger fires.
|
|
2321
|
+
|
|
2322
|
+
- Import: `import { defineShortcut } from 'motionary/components/widgets'; defineShortcut();`
|
|
2323
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2324
|
+
- Attributes: `keys`, `label`, `listen`, `for`
|
|
2325
|
+
- Events: `usa:trigger`
|
|
2326
|
+
- Methods: `press()`
|
|
2327
|
+
|
|
2328
|
+
```html
|
|
2329
|
+
<usa-shortcut keys="mod+k" label="Search"></usa-shortcut>
|
|
2330
|
+
<usa-shortcut keys="mod+shift+p" for="palette-button"></usa-shortcut>
|
|
2331
|
+
```
|
|
2332
|
+
|
|
2333
|
+
### <usa-skeleton> — Skeleton
|
|
2334
|
+
|
|
2335
|
+
Shimmering placeholders while loading; remove loading and the real content fades in. aria-busy included.
|
|
2336
|
+
|
|
2337
|
+
- Import: `import { defineSkeleton } from 'motionary/components/feedback'; defineSkeleton();`
|
|
2338
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2339
|
+
- Attributes: `loading`, `lines`, `width`, `height`, `circle`, `avatar`, `radius`
|
|
2340
|
+
- Events: `usa:loaded`
|
|
2341
|
+
|
|
2342
|
+
```html
|
|
2343
|
+
<usa-skeleton loading avatar lines="3">
|
|
2344
|
+
<article>…</article>
|
|
2345
|
+
</usa-skeleton>
|
|
2346
|
+
```
|
|
2347
|
+
|
|
2348
|
+
### <usa-skeleton-reveal> — Skeleton → content reveal
|
|
2349
|
+
|
|
2350
|
+
6.4: the skeleton is generated from the real content — one bar per rendered text line, blocks for images and marked elements — with one synchronized shimmer (wave, pulse or glow). Remove loading and the bars dissolve top-to-bottom while the content fades in from a blur.
|
|
2351
|
+
|
|
2352
|
+
- Import: `import { defineSkeletonReveal } from 'motionary/components/widgets'; defineSkeletonReveal();`
|
|
2353
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2354
|
+
- Attributes: `loading`, `variant`
|
|
2355
|
+
- Events: `usa:reveal`
|
|
2356
|
+
- Methods: `reveal()`
|
|
2357
|
+
|
|
2358
|
+
```html
|
|
2359
|
+
<usa-skeleton-reveal loading variant="wave">
|
|
2360
|
+
<img src="avatar.jpg" alt="" data-skeleton="circle">
|
|
2361
|
+
<h3>Ada Lovelace</h3>
|
|
2362
|
+
<p>…</p>
|
|
2363
|
+
</usa-skeleton-reveal>
|
|
2364
|
+
<!-- el.loading = false (or el.reveal()) when the data arrived -->
|
|
2365
|
+
```
|
|
2366
|
+
|
|
2367
|
+
### <usa-sketch-chart> — Sketch chart
|
|
2368
|
+
|
|
2369
|
+
8.5: a hand-drawn chart — wobbly pencil axes with hatched bars or a sketchy line, sketched in stroke by stroke when it scrolls into view.
|
|
2370
|
+
|
|
2371
|
+
- Import: `import { defineSketchChart } from 'motionary/components/widgets'; defineSketchChart();`
|
|
2372
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2373
|
+
- Attributes: `values`, `labels`, `type`, `color`, `label`
|
|
2374
|
+
- Events: `usa:drawn`
|
|
2375
|
+
- Methods: `setValues()`, `redraw()`
|
|
2376
|
+
|
|
2377
|
+
```html
|
|
2378
|
+
<usa-sketch-chart values="3,7,5,9" labels="Q1,Q2,Q3,Q4" label="Revenue"></usa-sketch-chart>
|
|
2379
|
+
```
|
|
2380
|
+
|
|
2381
|
+
### <usa-slider> — Slider
|
|
2382
|
+
|
|
2383
|
+
A form-associated range slider: spring-following thumb, value bubble, full keyboard support (arrows, Page Up/Down, Home/End).
|
|
2384
|
+
|
|
2385
|
+
- Import: `import { defineSlider } from 'motionary/components/ui'; defineSlider();`
|
|
2386
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2387
|
+
- Attributes: `min`, `max`, `disabled`, `label`
|
|
2388
|
+
- Events: `usa:input`, `usa:change`
|
|
2389
|
+
|
|
2390
|
+
```html
|
|
2391
|
+
<usa-slider name="volume" value="40" bubble label="Volume"></usa-slider>
|
|
2392
|
+
```
|
|
2393
|
+
|
|
2394
|
+
### <usa-sparkline> — Sparkline
|
|
2395
|
+
|
|
2396
|
+
7.2: a tiny inline trend — draws itself on first view, a soft area fades in, the last point pulses and new data morphs the line point by point. line | area | bars; hover shows the value.
|
|
2397
|
+
|
|
2398
|
+
- Import: `import { defineSparkline } from 'motionary/components/widgets'; defineSparkline();`
|
|
2399
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2400
|
+
- Attributes: `variant`, `color`
|
|
2401
|
+
|
|
2402
|
+
```html
|
|
2403
|
+
<usa-sparkline values="3,5,4,8,6,9,12" variant="area"></usa-sparkline>
|
|
2404
|
+
```
|
|
2405
|
+
|
|
2406
|
+
### <usa-spatial-card> — Spatial card
|
|
2407
|
+
|
|
2408
|
+
8.8: a spatial-computing window — frosted glass floating in depth, a soft gaze highlight that follows the pointer, layered content and an ornament bar; it eases towards you on hover and sinks on press.
|
|
2409
|
+
|
|
2410
|
+
- Import: `import { defineSpatialCard } from 'motionary/components/widgets'; defineSpatialCard();`
|
|
2411
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2412
|
+
- Events: `usa:focus-depth`
|
|
2413
|
+
|
|
2414
|
+
```html
|
|
2415
|
+
<usa-spatial-card>
|
|
2416
|
+
<h3 data-depth="2">Photos</h3>
|
|
2417
|
+
<p data-depth="1">Spatial window</p>
|
|
2418
|
+
<nav slot="ornament"><button>⟲</button><button>♡</button></nav>
|
|
2419
|
+
</usa-spatial-card>
|
|
2420
|
+
```
|
|
2421
|
+
|
|
2422
|
+
### <usa-spinner> — Spinners
|
|
2423
|
+
|
|
2424
|
+
Six indeterminate indicators: the WinUI progress ring, the Windows 10 orbiting dots, ring, typing dots, pulse and bars.
|
|
2425
|
+
|
|
2426
|
+
- Import: `import { defineSpinner } from 'motionary/components/feedback'; defineSpinner();`
|
|
2427
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2428
|
+
- Attributes: `kind`, `size`, `label`
|
|
2429
|
+
|
|
2430
|
+
```html
|
|
2431
|
+
<usa-spinner kind="fluent"></usa-spinner>
|
|
2432
|
+
<usa-spinner kind="windows" size="40"></usa-spinner>
|
|
2433
|
+
```
|
|
2434
|
+
|
|
2435
|
+
### <usa-splash> — Splash screen
|
|
2436
|
+
|
|
2437
|
+
An app launch screen that leaves (fade, scale, slide-up, circle) once the page has loaded — never sooner than min ms.
|
|
2438
|
+
|
|
2439
|
+
- Import: `import { defineSplash } from 'motionary/components/page'; defineSplash();`
|
|
2440
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2441
|
+
- Events: `usa:done`
|
|
2442
|
+
- Methods: `done()`
|
|
2443
|
+
|
|
2444
|
+
```html
|
|
2445
|
+
<usa-splash exit="circle" min="800">
|
|
2446
|
+
<img src="logo.svg" alt="">
|
|
2447
|
+
</usa-splash>
|
|
2448
|
+
```
|
|
2449
|
+
|
|
2450
|
+
### <usa-split-text> — Split-text reveal
|
|
2451
|
+
|
|
2452
|
+
Splits a headline into letters or words and cascades them in: rise, fade, blur, flip or pop. Words never break.
|
|
2453
|
+
|
|
2454
|
+
- Import: `import { defineSplitText } from 'motionary/components/text'; defineSplitText();`
|
|
2455
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2456
|
+
- Attributes: `by`, `text`
|
|
2457
|
+
- Events: `usa:complete`
|
|
2458
|
+
- Methods: `play()`, `reset()`
|
|
2459
|
+
|
|
2460
|
+
```html
|
|
2461
|
+
<usa-split-text effect="rise">Animated headline</usa-split-text>
|
|
2462
|
+
```
|
|
2463
|
+
|
|
2464
|
+
### <usa-spotlight> — Reveal highlight
|
|
2465
|
+
|
|
2466
|
+
The Windows Fluent “Reveal” effect: a light follows the pointer, lighting the borders of nearby items and the hovered one.
|
|
2467
|
+
|
|
2468
|
+
- Import: `import { defineSpotlight } from 'motionary/components/interaction'; defineSpotlight();`
|
|
2469
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2470
|
+
- Attributes: `size`, `color`, `border`
|
|
2471
|
+
|
|
2472
|
+
```html
|
|
2473
|
+
<usa-spotlight>
|
|
2474
|
+
<button>Mail</button>
|
|
2475
|
+
<button>Calendar</button>
|
|
2476
|
+
<button>Photos</button>
|
|
2477
|
+
</usa-spotlight>
|
|
2478
|
+
```
|
|
2479
|
+
|
|
2480
|
+
### <usa-spring> — Spring effects
|
|
2481
|
+
|
|
2482
|
+
bounce-in, pop and drop entrances with true spring timing (CSS linear() easing), plus jelly and rubber-band attention effects on view, hover or click.
|
|
2483
|
+
|
|
2484
|
+
- Import: `import { defineSpring } from 'motionary/components/physics'; defineSpring();`
|
|
2485
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2486
|
+
- Attributes: `effect`, `trigger`, `repeat`
|
|
2487
|
+
- Events: `usa:complete`
|
|
2488
|
+
- Methods: `play()`, `reset()`
|
|
2489
|
+
|
|
2490
|
+
```html
|
|
2491
|
+
<usa-spring effect="bounce-in" preset="bouncy">
|
|
2492
|
+
<div class="card">Hello</div>
|
|
2493
|
+
</usa-spring>
|
|
2494
|
+
<usa-spring effect="jelly" trigger="click">
|
|
2495
|
+
<button>Tap me</button>
|
|
2496
|
+
</usa-spring>
|
|
2497
|
+
```
|
|
2498
|
+
|
|
2499
|
+
### <usa-stagger> — Stagger list
|
|
2500
|
+
|
|
2501
|
+
Reveals direct children one after another — lists, grids, feature rows.
|
|
2502
|
+
|
|
2503
|
+
- Import: `import { defineStagger } from 'motionary/components/reveal'; defineStagger();`
|
|
2504
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2505
|
+
- Attributes: `effect`, `repeat`, `threshold`
|
|
2506
|
+
- Events: `usa:enter`, `usa:complete`
|
|
2507
|
+
- Methods: `reveal()`, `reset()`
|
|
2508
|
+
|
|
2509
|
+
```html
|
|
2510
|
+
<usa-stagger effect="rise" interval="80">
|
|
2511
|
+
<li>One</li>
|
|
2512
|
+
<li>Two</li>
|
|
2513
|
+
<li>Three</li>
|
|
2514
|
+
</usa-stagger>
|
|
2515
|
+
```
|
|
2516
|
+
|
|
2517
|
+
### <usa-star-rating> — Star rating 2.0
|
|
2518
|
+
|
|
2519
|
+
6.4: the fill follows the pointer (half stars with step="0.5"), a click pops the chosen star with a sparkle burst while the others ripple; stars or hearts; a keyboard slider (arrows, Home / End); readonly mode.
|
|
2520
|
+
|
|
2521
|
+
- Import: `import { defineStarRating } from 'motionary/components/widgets'; defineStarRating();`
|
|
2522
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2523
|
+
- Attributes: `max`, `icon`, `readonly`, `step`
|
|
2524
|
+
- Events: `usa:change`
|
|
2525
|
+
|
|
2526
|
+
```html
|
|
2527
|
+
<usa-star-rating value="3.5" step="0.5" label="Your rating"></usa-star-rating>
|
|
2528
|
+
<usa-star-rating value="4" readonly></usa-star-rating>
|
|
2529
|
+
```
|
|
2530
|
+
|
|
2531
|
+
### <usa-stepper> — Stepper / wizard
|
|
2532
|
+
|
|
2533
|
+
6.7: the rail fills toward the current step, finished steps pop a drawn check mark and the current step pulses. Horizontal or vertical; next() / prev() / value.
|
|
2534
|
+
|
|
2535
|
+
- Import: `import { defineStepper } from 'motionary/components/widgets'; defineStepper();`
|
|
2536
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2537
|
+
- Attributes: `orientation`
|
|
2538
|
+
- Events: `usa:change`
|
|
2539
|
+
- Methods: `next()`, `prev()`
|
|
2540
|
+
|
|
2541
|
+
```html
|
|
2542
|
+
<usa-stepper value="1" label="Checkout">
|
|
2543
|
+
<span>Cart</span>
|
|
2544
|
+
<span>Shipping</span>
|
|
2545
|
+
<span>Payment</span>
|
|
2546
|
+
<span>Done</span>
|
|
2547
|
+
</usa-stepper>
|
|
2548
|
+
```
|
|
2549
|
+
|
|
2550
|
+
### <usa-sticky-stack> — Sticky stack
|
|
2551
|
+
|
|
2552
|
+
Cards stick while you scroll and the covered ones shrink and dim as the next slides over them.
|
|
2553
|
+
|
|
2554
|
+
- Import: `import { defineStickyStack } from 'motionary/components/cards'; defineStickyStack();`
|
|
2555
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2556
|
+
- Attributes: `top`, `gap`, `scale`
|
|
2557
|
+
- Methods: `update()`
|
|
2558
|
+
|
|
2559
|
+
```html
|
|
2560
|
+
<usa-sticky-stack top="80">
|
|
2561
|
+
<section>One</section>
|
|
2562
|
+
<section>Two</section>
|
|
2563
|
+
<section>Three</section>
|
|
2564
|
+
</usa-sticky-stack>
|
|
2565
|
+
```
|
|
2566
|
+
|
|
2567
|
+
### <usa-sticky-wall> — Sticky-note wall
|
|
2568
|
+
|
|
2569
|
+
8.5: a wall of sticky notes — each child becomes a pinned paper note with a slight tilt, the notes drop onto the wall one by one, and a tap lifts a note to the front.
|
|
2570
|
+
|
|
2571
|
+
- Import: `import { defineStickyWall } from 'motionary/components/widgets'; defineStickyWall();`
|
|
2572
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2573
|
+
- Attributes: `seed`, `label`
|
|
2574
|
+
- Events: `usa:pick`
|
|
2575
|
+
- Methods: `pick()`
|
|
2576
|
+
|
|
2577
|
+
```html
|
|
2578
|
+
<usa-sticky-wall label="Ideas">
|
|
2579
|
+
<p>Ship 8.5 ✏️</p>
|
|
2580
|
+
<p data-color="pink">Call Mia</p>
|
|
2581
|
+
<p data-color="blue">Buy paper</p>
|
|
2582
|
+
</usa-sticky-wall>
|
|
2583
|
+
```
|
|
2584
|
+
|
|
2585
|
+
### <usa-stories> — Stories viewer
|
|
2586
|
+
|
|
2587
|
+
6.2: segmented progress bars, auto-advance, tap left / right to step, press and hold to pause, plus a pause button. Under reduced motion it waits for the user instead of advancing.
|
|
2588
|
+
|
|
2589
|
+
- Import: `import { defineStories } from 'motionary/components/widgets'; defineStories();`
|
|
2590
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2591
|
+
- Attributes: `duration`, `loop`
|
|
2592
|
+
- Events: `usa:end`, `usa:change`
|
|
2593
|
+
- Methods: `next()`, `prev()`, `goTo()`, `pause()`, `play()`
|
|
2594
|
+
|
|
2595
|
+
```html
|
|
2596
|
+
<usa-stories duration="5000" loop>
|
|
2597
|
+
<img src="1.jpg" alt="…">
|
|
2598
|
+
<img src="2.jpg" alt="…">
|
|
2599
|
+
</usa-stories>
|
|
2600
|
+
```
|
|
2601
|
+
|
|
2602
|
+
### <usa-story> — Story: before / after
|
|
2603
|
+
|
|
2604
|
+
5.4: <usa-story template="compare"> wipes from before to after as you scroll; the handle is draggable and a keyboard slider (←/→, Home/End). Full-page templates (pin, gallery, zoom) live on the Scroll stories page.
|
|
2605
|
+
|
|
2606
|
+
- Import: `import { defineStory } from 'motionary/components/effects'; defineStory();`
|
|
2607
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2608
|
+
- Attributes: `template`, `zoom`
|
|
2609
|
+
|
|
2610
|
+
```html
|
|
2611
|
+
<usa-story template="compare" label="2019 vs 2026">
|
|
2612
|
+
<div data-sticky>
|
|
2613
|
+
<img data-before src="before.jpg" alt="Before">
|
|
2614
|
+
<img data-after src="after.jpg" alt="After">
|
|
2615
|
+
</div>
|
|
2616
|
+
</usa-story>
|
|
2617
|
+
```
|
|
2618
|
+
|
|
2619
|
+
### <usa-suggestion-chips> — Suggestion chips
|
|
2620
|
+
|
|
2621
|
+
7.8: follow-up prompt chips that slide in one after another; picking one pulses it and (with dismiss) the others fade away. Real buttons, arrow-key navigation.
|
|
2622
|
+
|
|
2623
|
+
- Import: `import { defineSuggestionChips } from 'motionary/components/widgets'; defineSuggestionChips();`
|
|
2624
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2625
|
+
- Attributes: `items`, `label`, `dismiss`
|
|
2626
|
+
- Events: `usa:pick`
|
|
2627
|
+
- Methods: `setItems()`
|
|
2628
|
+
|
|
2629
|
+
```html
|
|
2630
|
+
<usa-suggestion-chips items="Summarise|Translate|Explain like I'm 5" dismiss></usa-suggestion-chips>
|
|
2631
|
+
```
|
|
2632
|
+
|
|
2633
|
+
### <usa-swipe-deck> — Swipe cards deck
|
|
2634
|
+
|
|
2635
|
+
6.8: drag the top card — it rotates with the pointer, LIKE / NOPE stamps fade in and past the threshold (or on a fling) it flies off; otherwise it springs back. like(), nope(), undo(), ← / →.
|
|
2636
|
+
|
|
2637
|
+
- Import: `import { defineSwipeDeck } from 'motionary/components/widgets'; defineSwipeDeck();`
|
|
2638
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2639
|
+
- Events: `usa:swipe`, `usa:empty`
|
|
2640
|
+
- Methods: `like()`, `nope()`, `undo()`
|
|
2641
|
+
|
|
2642
|
+
```html
|
|
2643
|
+
<usa-swipe-deck threshold="110" label="Matches">
|
|
2644
|
+
<article>Ada</article>
|
|
2645
|
+
<article>Linus</article>
|
|
2646
|
+
<article>Grace</article>
|
|
2647
|
+
</usa-swipe-deck>
|
|
2648
|
+
```
|
|
2649
|
+
|
|
2650
|
+
### <usa-swipeable> — Swipeable
|
|
2651
|
+
|
|
2652
|
+
Swipe-to-dismiss and swipe actions: content follows the finger, flies out on a fast swipe or past the distance, otherwise springs home with your release velocity. Delete / arrow keys work too.
|
|
2653
|
+
|
|
2654
|
+
- Import: `import { defineSwipeable } from 'motionary/components/gesture'; defineSwipeable();`
|
|
2655
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2656
|
+
- Attributes: `axis`, `disabled`
|
|
2657
|
+
- Events: `usa:swipe`, `usa:dismiss`
|
|
2658
|
+
- Methods: `swipe()`, `reset()`
|
|
2659
|
+
|
|
2660
|
+
```html
|
|
2661
|
+
<usa-swipeable distance="120" dismiss>
|
|
2662
|
+
<div class="card">Swipe me away</div>
|
|
2663
|
+
</usa-swipeable>
|
|
2664
|
+
```
|
|
2665
|
+
|
|
2666
|
+
### <usa-switch> — Toggle switch variants
|
|
2667
|
+
|
|
2668
|
+
6.7: four switches — iOS (the thumb stretches while pressed), day / night (sun becomes moon, stars appear), bounce (squash at the end) and liquid (a gooey fill pours in). role="switch", forms, keyboard.
|
|
2669
|
+
|
|
2670
|
+
- Import: `import { defineSwitch } from 'motionary/components/widgets'; defineSwitch();`
|
|
2671
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2672
|
+
- Attributes: `variant`
|
|
2673
|
+
- Events: `usa:change`
|
|
2674
|
+
- Methods: `toggle()`
|
|
2675
|
+
|
|
2676
|
+
```html
|
|
2677
|
+
<usa-switch variant="daynight" name="dark" label="Dark mode"></usa-switch>
|
|
2678
|
+
```
|
|
2679
|
+
|
|
2680
|
+
### <usa-tab-bar> — Tabs with animated indicator
|
|
2681
|
+
|
|
2682
|
+
6.2: the indicator stretches from the old tab to the new one (leading edge first) and the panel slides in from the side of travel. Pill, underline, glow or gooey; full tablist keyboard support.
|
|
2683
|
+
|
|
2684
|
+
- Import: `import { defineTabBar } from 'motionary/components/widgets'; defineTabBar();`
|
|
2685
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2686
|
+
- Attributes: `indicator`
|
|
2687
|
+
- Events: `usa:change`
|
|
2688
|
+
- Methods: `select()`
|
|
2689
|
+
|
|
2690
|
+
```html
|
|
2691
|
+
<usa-tab-bar indicator="pill">
|
|
2692
|
+
<button>Overview</button>
|
|
2693
|
+
<button>Specs</button>
|
|
2694
|
+
<button>Reviews</button>
|
|
2695
|
+
<div data-panel>…</div>
|
|
2696
|
+
<div data-panel>…</div>
|
|
2697
|
+
<div data-panel>…</div>
|
|
2698
|
+
</usa-tab-bar>
|
|
2699
|
+
```
|
|
2700
|
+
|
|
2701
|
+
### <usa-tabs> — Tabs
|
|
2702
|
+
|
|
2703
|
+
Accessible tabs whose indicator slides between tabs with a spring; panels slide in from the direction you moved. Line or pill indicator.
|
|
2704
|
+
|
|
2705
|
+
- Import: `import { defineTabs } from 'motionary/components/ui'; defineTabs();`
|
|
2706
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2707
|
+
- Attributes: `indicator`
|
|
2708
|
+
- Events: `usa:change`
|
|
2709
|
+
- Methods: `select()`
|
|
2710
|
+
|
|
2711
|
+
```html
|
|
2712
|
+
<usa-tabs>
|
|
2713
|
+
<nav><button data-tab>One</button><button data-tab>Two</button></nav>
|
|
2714
|
+
<section data-panel>…</section>
|
|
2715
|
+
<section data-panel>…</section>
|
|
2716
|
+
</usa-tabs>
|
|
2717
|
+
```
|
|
2718
|
+
|
|
2719
|
+
### <usa-terminal> — Terminal window
|
|
2720
|
+
|
|
2721
|
+
8.2: a retro terminal window that types its commands after the prompt with a blinking block cursor and prints the output line by line when it scrolls into view — dark, green-phosphor or amber.
|
|
2722
|
+
|
|
2723
|
+
- Import: `import { defineTerminal } from 'motionary/components/widgets'; defineTerminal();`
|
|
2724
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2725
|
+
- Attributes: `title`, `prompt`, `theme`, `speed`
|
|
2726
|
+
- Events: `usa:done`
|
|
2727
|
+
- Methods: `replay()`, `skip()`
|
|
2728
|
+
|
|
2729
|
+
```html
|
|
2730
|
+
<usa-terminal title="zsh" theme="green">
|
|
2731
|
+
<p data-cmd>npm i motionary</p>
|
|
2732
|
+
<p>added 1 package in 2s</p>
|
|
2733
|
+
</usa-terminal>
|
|
2734
|
+
```
|
|
2735
|
+
|
|
2736
|
+
### <usa-text-rotate> — Rotating words
|
|
2737
|
+
|
|
2738
|
+
Cycles words in place — the box keeps the width of the longest word, so nothing around it reflows.
|
|
2739
|
+
|
|
2740
|
+
- Import: `import { defineTextRotate } from 'motionary/components/text'; defineTextRotate();`
|
|
2741
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2742
|
+
- Attributes: `words`, `interval`, `paused`
|
|
2743
|
+
- Events: `usa:change`
|
|
2744
|
+
- Methods: `next()`
|
|
2745
|
+
|
|
2746
|
+
```html
|
|
2747
|
+
Build <usa-text-rotate words="fast|tiny|typed"></usa-text-rotate> apps
|
|
2748
|
+
```
|
|
2749
|
+
|
|
2750
|
+
### <usa-theme-surface> — Theme surface
|
|
2751
|
+
|
|
2752
|
+
8.6: a themeable card that follows the nearest theme — light, dark, neon (pulsing glow edge), glass (frosted backdrop with a sheen) or soft neumorphic relief — and cross-fades when the theme changes.
|
|
2753
|
+
|
|
2754
|
+
- Import: `import { defineThemeSurface } from 'motionary/components/widgets'; defineThemeSurface();`
|
|
2755
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2756
|
+
- Attributes: `theme`
|
|
2757
|
+
- Events: `usa:theme`
|
|
2758
|
+
|
|
2759
|
+
```html
|
|
2760
|
+
<usa-theme-surface theme="glass">
|
|
2761
|
+
<h3>Frosted</h3><p>Content…</p>
|
|
2762
|
+
</usa-theme-surface>
|
|
2763
|
+
```
|
|
2764
|
+
|
|
2765
|
+
### <usa-theme-switcher> — Theme switcher
|
|
2766
|
+
|
|
2767
|
+
8.6: a segmented switcher for the 8.6 theme system — light, dark, neon, glass and soft (neumorphism); a pill slides under the active option and the page change is revealed with a circular wipe from the click point.
|
|
2768
|
+
|
|
2769
|
+
- Import: `import { defineThemeSwitcher } from 'motionary/components/widgets'; defineThemeSwitcher();`
|
|
2770
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2771
|
+
- Attributes: `themes`, `target`, `label`
|
|
2772
|
+
- Events: `usa:change`
|
|
2773
|
+
|
|
2774
|
+
```html
|
|
2775
|
+
<usa-theme-switcher themes="light,dark,neon,glass,neu" persist></usa-theme-switcher>
|
|
2776
|
+
```
|
|
2777
|
+
|
|
2778
|
+
### <usa-tilt> — 3D tilt card
|
|
2779
|
+
|
|
2780
|
+
Tilts toward the pointer in 3D with an optional glare; exposes --usa-tilt-x/y for parallax layers inside.
|
|
2781
|
+
|
|
2782
|
+
- Import: `import { defineTilt } from 'motionary/components/interaction'; defineTilt();`
|
|
2783
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2784
|
+
- Attributes: `max`, `scale`, `perspective`, `glare`, `reverse`, `disabled`
|
|
2785
|
+
|
|
2786
|
+
```html
|
|
2787
|
+
<usa-tilt glare max="12">
|
|
2788
|
+
<div class="card">…</div>
|
|
2789
|
+
</usa-tilt>
|
|
2790
|
+
```
|
|
2791
|
+
|
|
2792
|
+
### <usa-timeline> — Timeline
|
|
2793
|
+
|
|
2794
|
+
Every data-tl child becomes a step in document order. data-at ('-=200', '<', 'label+=100') overlaps or aligns steps; scrub ties progress to scroll; trigger view / click / manual.
|
|
2795
|
+
|
|
2796
|
+
- Import: `import { defineTimeline } from 'motionary/components/timeline'; defineTimeline();`
|
|
2797
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2798
|
+
- Attributes: `scrub`, `trigger`, `overlap`
|
|
2799
|
+
- Events: `usa:complete`
|
|
2800
|
+
- Methods: `play()`, `reverse()`, `seek()`
|
|
2801
|
+
|
|
2802
|
+
```html
|
|
2803
|
+
<usa-timeline overlap="150">
|
|
2804
|
+
<h2 data-tl="fade-up">Title</h2>
|
|
2805
|
+
<p data-tl="blur">Subtitle</p>
|
|
2806
|
+
<button data-tl="scale" data-at="<+=100">CTA</button>
|
|
2807
|
+
</usa-timeline>
|
|
2808
|
+
```
|
|
2809
|
+
|
|
2810
|
+
### <usa-tip> — Tooltip / popover 2.0
|
|
2811
|
+
|
|
2812
|
+
6.6: springs out of its trigger with an arrow, flips to stay inside the viewport and shifts along the edge; hover + keyboard focus (Esc closes) or click popovers with rich content.
|
|
2813
|
+
|
|
2814
|
+
- Import: `import { defineTip } from 'motionary/components/widgets'; defineTip();`
|
|
2815
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2816
|
+
- Attributes: `text`, `placement`, `trigger`
|
|
2817
|
+
- Events: `usa:open`, `usa:close`
|
|
2818
|
+
- Methods: `show()`, `hide()`
|
|
2819
|
+
|
|
2820
|
+
```html
|
|
2821
|
+
<usa-tip text="Copied to clipboard" placement="top">
|
|
2822
|
+
<button>Copy</button>
|
|
2823
|
+
</usa-tip>
|
|
2824
|
+
<usa-tip trigger="click" placement="bottom">
|
|
2825
|
+
<button>Details</button>
|
|
2826
|
+
<div slot="tip"><strong>Pro tip</strong> …</div>
|
|
2827
|
+
</usa-tip>
|
|
2828
|
+
```
|
|
2829
|
+
|
|
2830
|
+
### <usa-toast-stack> — Toast stack
|
|
2831
|
+
|
|
2832
|
+
6.3: toasts pile up into a collapsed stack (newest in front, older ones peeking behind), fan out on hover or focus, auto-dismiss (paused while hovered) and swipe away. Six positions, a polite live region, stackToast() helper and data-usa-toast triggers.
|
|
2833
|
+
|
|
2834
|
+
- Import: `import { defineToastStack } from 'motionary/components/widgets'; defineToastStack();`
|
|
2835
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2836
|
+
- Attributes: `position`
|
|
2837
|
+
- Events: `usa:show`, `usa:dismiss`
|
|
2838
|
+
- Methods: `show()`, `dismiss()`, `clear()`
|
|
2839
|
+
|
|
2840
|
+
```html
|
|
2841
|
+
<button data-usa-toast="Saved to your library" data-usa-toast-type="success">Save</button>
|
|
2842
|
+
<usa-toast-stack position="bottom-right" duration="4000" max="3"></usa-toast-stack>
|
|
2843
|
+
<!-- or from JS: stackToast({ title: 'Done', message: 'Saved', type: 'success' }) -->
|
|
2844
|
+
```
|
|
2845
|
+
|
|
2846
|
+
### <usa-toaster> — Toasts
|
|
2847
|
+
|
|
2848
|
+
toast("Saved") slides a notification in; it pauses on hover, stacks with FLIP and announces politely (errors assertively).
|
|
2849
|
+
|
|
2850
|
+
- Import: `import { defineToaster } from 'motionary/components/feedback'; defineToaster();`
|
|
2851
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2852
|
+
- Attributes: `label`
|
|
2853
|
+
- Events: `usa:toast`
|
|
2854
|
+
- Methods: `show()`, `clear()`
|
|
2855
|
+
|
|
2856
|
+
```html
|
|
2857
|
+
<usa-toaster position="bottom-right"></usa-toaster>
|
|
2858
|
+
<script type="module">
|
|
2859
|
+
import { toast } from 'motionary/components/feedback';
|
|
2860
|
+
toast('Saved', { type: 'success' });
|
|
2861
|
+
</script>
|
|
2862
|
+
```
|
|
2863
|
+
|
|
2864
|
+
### <usa-typewriter> — Typewriter
|
|
2865
|
+
|
|
2866
|
+
Types text, or cycles through phrases with delete and pause. Full text stays available to screen readers.
|
|
2867
|
+
|
|
2868
|
+
- Import: `import { defineTypewriter } from 'motionary/components/text'; defineTypewriter();`
|
|
2869
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2870
|
+
- Attributes: `text`, `words`
|
|
2871
|
+
- Events: `usa:complete`
|
|
2872
|
+
- Methods: `start()`, `stop()`, `restart()`
|
|
2873
|
+
|
|
2874
|
+
```html
|
|
2875
|
+
<usa-typewriter words="Hello, Windows.|Hello, web." loop></usa-typewriter>
|
|
2876
|
+
```
|
|
2877
|
+
|
|
2878
|
+
### <usa-upload-progress> — Upload progress
|
|
2879
|
+
|
|
2880
|
+
7.7: a file row whose bar eases to value with a running shine; at 100 it turns into a check that draws itself, on error it shakes and offers Retry.
|
|
2881
|
+
|
|
2882
|
+
- Import: `import { defineUploadProgress } from 'motionary/components/widgets'; defineUploadProgress();`
|
|
2883
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2884
|
+
- Attributes: `name`, `size`, `value`, `status`, `message`
|
|
2885
|
+
- Events: `usa:retry`, `usa:done`, `usa:error`
|
|
2886
|
+
|
|
2887
|
+
```html
|
|
2888
|
+
<usa-upload-progress name="report.pdf" size="2400000" value="40"></usa-upload-progress>
|
|
2889
|
+
<script>row.value = 75; row.status = 'error';</script>
|
|
2890
|
+
```
|
|
2891
|
+
|
|
2892
|
+
### <usa-video-card> — Video card
|
|
2893
|
+
|
|
2894
|
+
9.4: a video thumbnail card — hover or focus plays a muted preview with a progress line, a play badge and a duration chip; without a video the poster drifts (Ken Burns).
|
|
2895
|
+
|
|
2896
|
+
- Import: `import { defineVideoCard } from 'motionary/components/widgets'; defineVideoCard();`
|
|
2897
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2898
|
+
- Attributes: `label`, `duration`
|
|
2899
|
+
- Events: `usa:open`
|
|
2900
|
+
|
|
2901
|
+
```html
|
|
2902
|
+
<usa-video-card duration="2:41">
|
|
2903
|
+
<img src="poster.jpg" alt="">
|
|
2904
|
+
<video src="preview.mp4" muted playsinline></video>
|
|
2905
|
+
<h3>Making of Motionary</h3>
|
|
2906
|
+
</usa-video-card>
|
|
2907
|
+
```
|
|
2908
|
+
|
|
2909
|
+
### <usa-view-switch> — View switch
|
|
2910
|
+
|
|
2911
|
+
One view at a time with direction-aware slide, fade, scale or drill transitions — tabs, wizards, app pages.
|
|
2912
|
+
|
|
2913
|
+
- Import: `import { defineViewSwitch } from 'motionary/components/transitions'; defineViewSwitch();`
|
|
2914
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2915
|
+
- Attributes: `active`
|
|
2916
|
+
- Events: `usa:change`
|
|
2917
|
+
- Methods: `show()`
|
|
2918
|
+
|
|
2919
|
+
```html
|
|
2920
|
+
<usa-view-switch active="home">
|
|
2921
|
+
<section data-view="home">…</section>
|
|
2922
|
+
<section data-view="about">…</section>
|
|
2923
|
+
</usa-view-switch>
|
|
2924
|
+
```
|
|
2925
|
+
|
|
2926
|
+
### <usa-voice-button> — Voice button
|
|
2927
|
+
|
|
2928
|
+
7.8: a push-to-talk mic button — while listening a halo breathes and level bars wave; feed it live input levels with level (0–1) and they follow your voice.
|
|
2929
|
+
|
|
2930
|
+
- Import: `import { defineVoiceButton } from 'motionary/components/widgets'; defineVoiceButton();`
|
|
2931
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2932
|
+
- Attributes: `label`, `bars`, `listening`
|
|
2933
|
+
- Methods: `toggle()`
|
|
2934
|
+
|
|
2935
|
+
```html
|
|
2936
|
+
<usa-voice-button label="Talk to the assistant"></usa-voice-button>
|
|
2937
|
+
<script>vb.addEventListener('usa:start', start); analyser.onlevel = (l) => (vb.level = l);</script>
|
|
2938
|
+
```
|
|
2939
|
+
|
|
2940
|
+
### <usa-volume-knob> — Volume knob
|
|
2941
|
+
|
|
2942
|
+
7.1: a rotary knob — drag up / down, scroll or use the keys; the value arc fills, a ring of LED ticks lights up and the pointer springs to the angle. role="slider".
|
|
2943
|
+
|
|
2944
|
+
- Import: `import { defineVolumeKnob } from 'motionary/components/widgets'; defineVolumeKnob();`
|
|
2945
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2946
|
+
- Attributes: `min`, `max`
|
|
2947
|
+
- Events: `usa:change`, `usa:input`
|
|
2948
|
+
|
|
2949
|
+
```html
|
|
2950
|
+
<usa-volume-knob value="60" label="Volume"></usa-volume-knob>
|
|
2951
|
+
```
|
|
2952
|
+
|
|
2953
|
+
### <usa-water-ripple> — Water ripple
|
|
2954
|
+
|
|
2955
|
+
Interactive water ripples on a canvas over the content: move or tap to disturb the surface.
|
|
2956
|
+
|
|
2957
|
+
- Import: `import { defineWaterRipple } from 'motionary/components/background'; defineWaterRipple();`
|
|
2958
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2959
|
+
- Methods: `mount()`
|
|
2960
|
+
|
|
2961
|
+
```html
|
|
2962
|
+
<usa-water-ripple>
|
|
2963
|
+
<img src="lake.jpg" alt="">
|
|
2964
|
+
</usa-water-ripple>
|
|
2965
|
+
```
|
|
2966
|
+
|
|
2967
|
+
### <usa-wave-text> — Wave text
|
|
2968
|
+
|
|
2969
|
+
Letters bob in a travelling wave — playful headlines and loading labels.
|
|
2970
|
+
|
|
2971
|
+
- Import: `import { defineWaveText } from 'motionary/components/text'; defineWaveText();`
|
|
2972
|
+
- CDN: https://unpkg.com/motionary@10/dist/components.umd.js
|
|
2973
|
+
- Attributes: `text`
|
|
2974
|
+
- Methods: `mount()`, `splitChars()`
|
|
2975
|
+
|
|
2976
|
+
```html
|
|
2977
|
+
<usa-wave-text>Loading…</usa-wave-text>
|
|
2978
|
+
```
|
|
2979
|
+
|
|
2980
|
+
### <usa-weather-card> — Animated weather card
|
|
2981
|
+
|
|
2982
|
+
6.8: sun rays turn, clouds drift, rain and snow fall, a flash-safe bolt glows, fog bands and stars — pick a condition and the scene cross-fades; the temperature counts up.
|
|
2983
|
+
|
|
2984
|
+
- Import: `import { defineWeatherCard } from 'motionary/components/widgets'; defineWeatherCard();`
|
|
2985
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2986
|
+
- Attributes: `condition`, `temp`, `place`, `unit`, `label`
|
|
2987
|
+
|
|
2988
|
+
```html
|
|
2989
|
+
<usa-weather-card condition="rain" temp="12" place="Lisbon"></usa-weather-card>
|
|
2990
|
+
```
|
|
2991
|
+
|
|
2992
|
+
### <usa-worker-canvas> — Worker canvas
|
|
2993
|
+
|
|
2994
|
+
9.6: a canvas animation rendered in a Web Worker on an OffscreenCanvas — the main thread stays free for input — with a main-thread fallback; particles, orbits, starfield or your own draw program.
|
|
2995
|
+
|
|
2996
|
+
- Import: `import { defineWorkerCanvas } from 'motionary/components/widgets'; defineWorkerCanvas();`
|
|
2997
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
2998
|
+
- Attributes: `scene`, `label`
|
|
2999
|
+
- Events: `usa:backend`
|
|
3000
|
+
|
|
3001
|
+
```html
|
|
3002
|
+
<usa-worker-canvas scene="starfield" style="height:240px"></usa-worker-canvas>
|
|
3003
|
+
```
|
|
3004
|
+
|
|
3005
|
+
### <usa-xp-bar> — XP bar
|
|
3006
|
+
|
|
3007
|
+
7.5: an experience bar — add(n) fills it smoothly; overflowing fills to the end, the level badge pops and the bar restarts with the remainder (several levels if needed).
|
|
3008
|
+
|
|
3009
|
+
- Import: `import { defineXpBar } from 'motionary/components/widgets'; defineXpBar();`
|
|
3010
|
+
- CDN: https://unpkg.com/motionary@10/dist/widgets.umd.js
|
|
3011
|
+
- Attributes: `level`, `xp`, `per`
|
|
3012
|
+
- Events: `usa:levelup`, `usa:xp`
|
|
3013
|
+
- Methods: `add()`
|
|
3014
|
+
|
|
3015
|
+
```html
|
|
3016
|
+
<usa-xp-bar level="3" xp="40" per="100"></usa-xp-bar>
|
|
3017
|
+
<script>bar.add(75); // → level 4, 15 XP</script>
|
|
3018
|
+
```
|