motionary 10.6.0 → 10.8.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/AGENTS.md +2 -0
- package/CHANGELOG.md +36 -0
- package/README.md +77 -4
- package/bin/motionary-mcp.mjs +160 -11
- package/dist/chunks/{anim-image-DECLkPH4.cjs → anim-image-BzTQa2k3.cjs} +2 -2
- package/dist/chunks/{anim-image-DECLkPH4.cjs.map → anim-image-BzTQa2k3.cjs.map} +1 -1
- package/dist/chunks/{anim-image-DNghy017.js → anim-image-iD646Q7i.js} +2 -2
- package/dist/chunks/{anim-image-DNghy017.js.map → anim-image-iD646Q7i.js.map} +1 -1
- package/dist/chunks/{keyframes-F6vp6tZZ.js → keyframes-B4zefz0k.js} +2 -2
- package/dist/chunks/{keyframes-F6vp6tZZ.js.map → keyframes-B4zefz0k.js.map} +1 -1
- package/dist/chunks/{keyframes-CbUZjD_5.cjs → keyframes-BlOyB1PP.cjs} +2 -2
- package/dist/chunks/{keyframes-CbUZjD_5.cjs.map → keyframes-BlOyB1PP.cjs.map} +1 -1
- package/dist/chunks/{registry-dr1CPTk1.cjs → registry-BZxDVL3h.cjs} +2 -2
- package/dist/chunks/{registry-dr1CPTk1.cjs.map → registry-BZxDVL3h.cjs.map} +1 -1
- package/dist/chunks/{registry-D8LAoXI-.js → registry-Bkt3-3ET.js} +3 -3
- package/dist/chunks/{registry-D8LAoXI-.js.map → registry-Bkt3-3ET.js.map} +1 -1
- package/dist/chunks/runtime-link-CUiZ8lbE.cjs +38 -0
- package/dist/chunks/runtime-link-CUiZ8lbE.cjs.map +1 -0
- package/dist/chunks/runtime-link-c13gskBZ.js +36 -0
- package/dist/chunks/runtime-link-c13gskBZ.js.map +1 -0
- package/dist/chunks/{ticker-DaAlEyOd.cjs → ticker-BfxAECfO.cjs} +2 -2
- package/dist/chunks/{ticker-DaAlEyOd.cjs.map → ticker-BfxAECfO.cjs.map} +1 -1
- package/dist/chunks/{ticker-Do9bGsaV.js → ticker-ZtweD3U4.js} +2 -2
- package/dist/chunks/{ticker-Do9bGsaV.js.map → ticker-ZtweD3U4.js.map} +1 -1
- package/dist/chunks/{tween-CmkdSyaC.cjs → tween--MD-39y0.cjs} +2 -2
- package/dist/chunks/{tween-CmkdSyaC.cjs.map → tween--MD-39y0.cjs.map} +1 -1
- package/dist/chunks/{tween-BzCGq_Ba.js → tween-DACdkLyO.js} +2 -2
- package/dist/chunks/{tween-BzCGq_Ba.js.map → tween-DACdkLyO.js.map} +1 -1
- package/dist/components/ai.cjs +314 -0
- package/dist/components/ai.cjs.map +1 -0
- package/dist/components/ai.d.cts +58 -0
- package/dist/components/ai.d.ts +58 -0
- package/dist/components/ai.js +311 -0
- package/dist/components/ai.js.map +1 -0
- package/dist/components/snap-carousel.cjs +216 -0
- package/dist/components/snap-carousel.cjs.map +1 -0
- package/dist/components/snap-carousel.d.cts +80 -0
- package/dist/components/snap-carousel.d.ts +80 -0
- package/dist/components/snap-carousel.js +214 -0
- package/dist/components/snap-carousel.js.map +1 -0
- package/dist/components/widgets.cjs +626 -268
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +515 -39
- package/dist/components/widgets.d.ts +515 -39
- package/dist/components/widgets.js +617 -262
- package/dist/components/widgets.js.map +1 -1
- package/dist/llms-full.txt +191 -6
- package/dist/llms.txt +10 -3
- package/dist/manifest.json +497 -19
- package/dist/runtime/drag-snap.cjs +269 -0
- package/dist/runtime/drag-snap.cjs.map +1 -0
- package/dist/runtime/drag-snap.d.cts +109 -0
- package/dist/runtime/drag-snap.d.ts +109 -0
- package/dist/runtime/drag-snap.iife.js +2 -0
- package/dist/runtime/drag-snap.iife.js.map +1 -0
- package/dist/runtime/drag-snap.js +261 -0
- package/dist/runtime/drag-snap.js.map +1 -0
- package/dist/runtime/format-apng.cjs +4 -4
- package/dist/runtime/format-apng.js +4 -4
- package/dist/runtime/format-css.cjs +4 -4
- package/dist/runtime/format-css.js +4 -4
- package/dist/runtime/format-gif.cjs +4 -4
- package/dist/runtime/format-gif.js +4 -4
- package/dist/runtime/format-gltf.cjs +37 -18
- package/dist/runtime/format-gltf.cjs.map +1 -1
- package/dist/runtime/format-gltf.d.cts +18 -2
- package/dist/runtime/format-gltf.d.ts +18 -2
- package/dist/runtime/format-gltf.iife.js +1 -1
- package/dist/runtime/format-gltf.iife.js.map +1 -1
- package/dist/runtime/format-gltf.js +37 -18
- package/dist/runtime/format-gltf.js.map +1 -1
- package/dist/runtime/format-motion.cjs +4 -4
- package/dist/runtime/format-motion.js +4 -4
- package/dist/runtime/format-obj.cjs +1 -1
- package/dist/runtime/format-obj.d.cts +2 -0
- package/dist/runtime/format-obj.d.ts +2 -0
- package/dist/runtime/format-obj.iife.js.map +1 -1
- package/dist/runtime/format-obj.js +1 -1
- package/dist/runtime/format-scene.cjs +241 -0
- package/dist/runtime/format-scene.cjs.map +1 -0
- package/dist/runtime/format-scene.d.cts +349 -0
- package/dist/runtime/format-scene.d.ts +349 -0
- package/dist/runtime/format-scene.iife.js +2 -0
- package/dist/runtime/format-scene.iife.js.map +1 -0
- package/dist/runtime/format-scene.js +233 -0
- package/dist/runtime/format-scene.js.map +1 -0
- package/dist/runtime/format-sprite.cjs +3 -3
- package/dist/runtime/format-sprite.js +3 -3
- package/dist/runtime/format-svg.cjs +3 -3
- package/dist/runtime/format-svg.js +3 -3
- package/dist/runtime/format-webp.cjs +4 -4
- package/dist/runtime/format-webp.js +4 -4
- package/dist/runtime/gl.cjs +17 -4
- package/dist/runtime/gl.cjs.map +1 -1
- package/dist/runtime/gl.d.cts +2 -0
- package/dist/runtime/gl.d.ts +2 -0
- package/dist/runtime/gl.iife.js +1 -1
- package/dist/runtime/gl.iife.js.map +1 -1
- package/dist/runtime/gl.js +17 -4
- package/dist/runtime/gl.js.map +1 -1
- package/dist/runtime/gltf-anim.cjs +251 -0
- package/dist/runtime/gltf-anim.cjs.map +1 -0
- package/dist/runtime/gltf-anim.d.cts +216 -0
- package/dist/runtime/gltf-anim.d.ts +216 -0
- package/dist/runtime/gltf-anim.iife.js +2 -0
- package/dist/runtime/gltf-anim.iife.js.map +1 -0
- package/dist/runtime/gltf-anim.js +243 -0
- package/dist/runtime/gltf-anim.js.map +1 -0
- package/dist/runtime/physics.cjs +739 -0
- package/dist/runtime/physics.cjs.map +1 -0
- package/dist/runtime/physics.d.cts +250 -0
- package/dist/runtime/physics.d.ts +250 -0
- package/dist/runtime/physics.iife.js +2 -0
- package/dist/runtime/physics.iife.js.map +1 -0
- package/dist/runtime/physics.js +731 -0
- package/dist/runtime/physics.js.map +1 -0
- package/dist/runtime/scroll.cjs +2 -2
- package/dist/runtime/scroll.js +2 -2
- package/dist/runtime/smooth.cjs +1 -1
- package/dist/runtime/smooth.js +1 -1
- package/dist/runtime/text.cjs +1 -1
- package/dist/runtime/text.js +1 -1
- package/dist/runtime/vector.cjs +421 -11
- package/dist/runtime/vector.cjs.map +1 -1
- package/dist/runtime/vector.d.cts +20 -4
- package/dist/runtime/vector.d.ts +20 -4
- package/dist/runtime/vector.iife.js +1 -1
- package/dist/runtime/vector.iife.js.map +1 -1
- package/dist/runtime/vector.js +421 -12
- package/dist/runtime/vector.js.map +1 -1
- package/dist/runtime.cjs +3 -3
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.iife.js +1 -1
- package/dist/runtime.iife.js.map +1 -1
- package/dist/runtime.js +5 -5
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +2 -2
- package/docs/components/README.md +5 -2
- package/docs/components/usa-gl-scene.md +27 -6
- package/docs/components/usa-lottie-player.md +18 -0
- package/docs/components/usa-motion-prompt.md +32 -0
- package/docs/components/usa-physics-playground.md +63 -0
- package/docs/components/usa-snap-carousel.md +68 -0
- package/docs/components.md +95 -3
- package/docs/runtime/drag-snap.md +60 -0
- package/docs/runtime/format-gltf.md +3 -2
- package/docs/runtime/format-scene.md +59 -0
- package/docs/runtime/gltf-anim.md +62 -0
- package/docs/runtime/physics.md +61 -0
- package/docs/runtime/vector.md +3 -2
- package/package.json +61 -1
package/docs/ROADMAP.md
CHANGED
|
@@ -69,11 +69,11 @@ Store 卡片显示 **「Requires: motionary/runtime/<module>」** 徽章(官
|
|
|
69
69
|
- 主线 B:**vector 模块** —— 矢量动画播放器,支持文档列出的 Lottie JSON 子集(形状、变换、修剪路径、基础遮罩、预合成、渐变;文档列出不支持的特性)+ dotLottie。
|
|
70
70
|
- 官方运行时:`<usa-rive>`(Requires: @rive-app/canvas,可选 peer,懒加载)。
|
|
71
71
|
- 新组件:令牌编辑器、`<usa-lottie-player>`、`<usa-rive>`。
|
|
72
|
-
- **v10.7** — AI 辅助动效:自然语言 → 动效描述、动效建议。
|
|
72
|
+
- ✅ **v10.7** — AI 辅助动效:自然语言 → 动效描述、动效建议。
|
|
73
73
|
- 主线 A:MCP 2.0 —— `suggest_motion`、`validate_snippet`;AI 使用评测集(运行 AI 写的片段检验能否直接工作)。
|
|
74
74
|
- 主线 B:**physics 模块** —— 2D 刚体(圆 / 盒 / 多边形)、约束;场景 JSON `motionary-scene@1`。
|
|
75
75
|
- 新组件:动效提示输入框、`<usa-physics-playground>`。
|
|
76
|
-
- **v10.8** — 跨端 3.0:小程序适配、鸿蒙 ArkTS 示例。
|
|
76
|
+
- ✅ **v10.8** — 跨端 3.0:小程序适配、鸿蒙 ArkTS 示例。
|
|
77
77
|
- 主线 B:**drag-snap 模块** —— 拖拽吸附 / 惯性轮播。
|
|
78
78
|
- 格式:glTF 蒙皮 / 变形目标 / 动画;Lottie 文本层 + 表达式子集。
|
|
79
79
|
- 新组件:跨端预览器、`<usa-snap-carousel>`(`<usa-carousel>` 已被 6.2 轮播占用)。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Motionary components (
|
|
1
|
+
# Motionary components (208)
|
|
2
2
|
|
|
3
3
|
One page per `<usa-*>` element, generated from the source. Machine-readable: `motionary/manifest.json` · Pages `/components.json` · `/llms.txt` · `/llms-full.txt`. How to use these with an AI assistant: [AGENTS.md](../../AGENTS.md) and [the prompt guide](../ai-prompt-guide.md).
|
|
4
4
|
|
|
@@ -51,7 +51,7 @@ One page per `<usa-*>` element, generated from the source. Machine-readable: `mo
|
|
|
51
51
|
- [`<usa-gauge>`](usa-gauge.md) — Spring gauge
|
|
52
52
|
- [`<usa-gen-art>`](usa-gen-art.md) — Generative artwork
|
|
53
53
|
- [`<usa-gesture-sticker>`](usa-gesture-sticker.md) — Multi-touch sticker
|
|
54
|
-
- [`<usa-gl-scene>`](usa-gl-scene.md) — 3D scene (glTF / OBJ) · Requires: motionary/runtime/gl + motionary/runtime/format-gltf + motionary/runtime/format-obj
|
|
54
|
+
- [`<usa-gl-scene>`](usa-gl-scene.md) — 3D scene (glTF / OBJ) · Requires: motionary/runtime/gl + motionary/runtime/format-gltf + motionary/runtime/format-obj + motionary/runtime/gltf-anim
|
|
55
55
|
- [`<usa-globe>`](usa-globe.md) — Spinning globe
|
|
56
56
|
- [`<usa-gpu-particles>`](usa-gpu-particles.md) — GPU particle canvas
|
|
57
57
|
- [`<usa-gyro-card>`](usa-gyro-card.md) — Gyro 3D card
|
|
@@ -71,6 +71,7 @@ One page per `<usa-*>` element, generated from the source. Machine-readable: `mo
|
|
|
71
71
|
- [`<usa-motion>`](usa-motion.md) — Motion DSL
|
|
72
72
|
- [`<usa-motion-inspector>`](usa-motion-inspector.md) — Motion inspector
|
|
73
73
|
- [`<usa-motion-prefs>`](usa-motion-prefs.md) — Motion preference panel
|
|
74
|
+
- [`<usa-motion-prompt>`](usa-motion-prompt.md) — Motion prompt (text → motion)
|
|
74
75
|
- [`<usa-motion-spec>`](usa-motion-spec.md) — Motion spec sheet
|
|
75
76
|
- [`<usa-music-player>`](usa-music-player.md) — Music player
|
|
76
77
|
- [`<usa-native-preview>`](usa-native-preview.md) — Native preview
|
|
@@ -83,6 +84,7 @@ One page per `<usa-*>` element, generated from the source. Machine-readable: `mo
|
|
|
83
84
|
- [`<usa-panorama>`](usa-panorama.md) — 360° panorama viewer
|
|
84
85
|
- [`<usa-pause-all>`](usa-pause-all.md) — Pause all motion
|
|
85
86
|
- [`<usa-perf-monitor>`](usa-perf-monitor.md) — Perf monitor
|
|
87
|
+
- [`<usa-physics-playground>`](usa-physics-playground.md) — Physics playground · Requires: motionary/runtime/physics + motionary/runtime/format-scene
|
|
86
88
|
- [`<usa-plugin-card>`](usa-plugin-card.md) — Plugin detail card · Requires: motionary/runtime
|
|
87
89
|
- [`<usa-plugin-store>`](usa-plugin-store.md) — Plugin marketplace
|
|
88
90
|
- [`<usa-popover>`](usa-popover.md) — Popover
|
|
@@ -102,6 +104,7 @@ One page per `<usa-*>` element, generated from the source. Machine-readable: `mo
|
|
|
102
104
|
- [`<usa-shortcut>`](usa-shortcut.md) — Shortcut hint
|
|
103
105
|
- [`<usa-sketch-chart>`](usa-sketch-chart.md) — Sketch chart
|
|
104
106
|
- [`<usa-slider>`](usa-slider.md) — Slider
|
|
107
|
+
- [`<usa-snap-carousel>`](usa-snap-carousel.md) — Snap carousel (drag · inertia · snap) · Requires: motionary/runtime/drag-snap
|
|
105
108
|
- [`<usa-sparkline>`](usa-sparkline.md) — Sparkline
|
|
106
109
|
- [`<usa-spatial-card>`](usa-spatial-card.md) — Spatial card
|
|
107
110
|
- [`<usa-stepper>`](usa-stepper.md) — Stepper / wizard
|
|
@@ -2,30 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
> Generated from the source and the gallery catalog by `scripts/gen-component-docs.mjs` (same data as [components.json](https://harrisoncn.github.io/Motionary/components.json) and [llms-full.txt](https://harrisoncn.github.io/Motionary/llms-full.txt)).
|
|
4
4
|
|
|
5
|
-
10.5: a WebGL2 3D viewer on Motionary’s own renderer — glTF 2.0 / GLB and OBJ / MTL models or built-in shapes, PBR-style materials, orbit controls (drag, wheel, pinch, arrow keys), auto-rotate and video textures. Requires motionary/runtime/gl (+ format-gltf for .gltf / .glb, format-obj for .obj) — npm i motionary, then use(gl, formatGltf, formatObj) before it mounts. Alias: <usa-three-scene>.
|
|
5
|
+
10.5: a WebGL2 3D viewer on Motionary’s own renderer — glTF 2.0 / GLB and OBJ / MTL models or built-in shapes, PBR-style materials, orbit controls (drag, wheel, pinch, arrow keys), auto-rotate and video textures. Requires motionary/runtime/gl (+ format-gltf for .gltf / .glb, format-obj for .obj, gltf-anim for glTF animation — 10.8) — npm i motionary, then use(gl, formatGltf, formatObj, gltfAnim) before it mounts. Alias: <usa-three-scene>.
|
|
6
6
|
|
|
7
7
|
- **Category:** ui · **since** 10.5
|
|
8
8
|
- **Import:** `import { defineGlScene } from 'motionary/components/widgets'` then `defineGlScene();`
|
|
9
9
|
- **CDN:** `<script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>`
|
|
10
|
-
- **Attributes:** `src`, `shape`, `color`, `metallic`, `roughness`, `background`, `exposure`, `controls`, `auto-rotate`, `video`, `video-scrub`, `label`
|
|
10
|
+
- **Attributes:** `src`, `shape`, `color`, `metallic`, `roughness`, `background`, `exposure`, `controls`, `auto-rotate`, `video`, `video-scrub`, `label`, `animation`, `animation-speed`
|
|
11
11
|
- **Events:** `usa:error`, `usa:load`, `usa:runtime-missing`
|
|
12
12
|
- **Slots:** —
|
|
13
13
|
- **Methods:** `reload()`
|
|
14
14
|
- **Source:** [src/components/widgets/gl-scene.ts](../../src/components/widgets/gl-scene.ts)
|
|
15
15
|
|
|
16
|
-
## Prerequisites — Requires: motionary/runtime/gl + motionary/runtime/format-gltf + motionary/runtime/format-obj
|
|
16
|
+
## Prerequisites — Requires: motionary/runtime/gl + motionary/runtime/format-gltf + motionary/runtime/format-obj + motionary/runtime/gltf-anim
|
|
17
17
|
|
|
18
18
|
1. **Install:** `npm i motionary`
|
|
19
|
-
2. **Import order & registration:** Register the core first, then the module: use(gl) also registers the core. CDN: load runtime.iife.js, then runtime/gl.iife.js (it registers itself). Register the core first, then the module: use(formatGltf) also registers the core. CDN: load runtime.iife.js, then runtime/format-gltf.iife.js (it registers itself). Register the core first, then the module: use(formatObj) also registers the core. CDN: load runtime.iife.js, then runtime/format-obj.iife.js (it registers itself).
|
|
19
|
+
2. **Import order & registration:** Register the core first, then the module: use(gl) also registers the core. CDN: load runtime.iife.js, then runtime/gl.iife.js (it registers itself). Register the core first, then the module: use(formatGltf) also registers the core. CDN: load runtime.iife.js, then runtime/format-gltf.iife.js (it registers itself). Register the core first, then the module: use(formatObj) also registers the core. CDN: load runtime.iife.js, then runtime/format-obj.iife.js (it registers itself). Register the core first, then the module: use(gltfAnim) also registers the core. CDN: load runtime.iife.js, then runtime/gltf-anim.iife.js (it registers itself).
|
|
20
20
|
|
|
21
21
|
```js
|
|
22
22
|
import { use } from 'motionary/runtime';
|
|
23
23
|
import { gl } from 'motionary/runtime/gl';
|
|
24
24
|
import { formatGltf } from 'motionary/runtime/format-gltf';
|
|
25
25
|
import { formatObj } from 'motionary/runtime/format-obj';
|
|
26
|
+
import { gltfAnim } from 'motionary/runtime/gltf-anim';
|
|
26
27
|
import { defineGlScene } from 'motionary/components/widgets';
|
|
27
28
|
|
|
28
|
-
use(gl, formatGltf, formatObj);
|
|
29
|
+
use(gl, formatGltf, formatObj, gltfAnim);
|
|
29
30
|
defineGlScene(); // registers <usa-gl-scene> — after the prerequisites
|
|
30
31
|
```
|
|
31
32
|
|
|
@@ -36,6 +37,7 @@ defineGlScene(); // registers <usa-gl-scene> — after the prerequisites
|
|
|
36
37
|
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/gl.iife.js"></script>
|
|
37
38
|
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-gltf.iife.js"></script>
|
|
38
39
|
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-obj.iife.js"></script>
|
|
40
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/gltf-anim.iife.js"></script>
|
|
39
41
|
<!-- then the component bundles -->
|
|
40
42
|
<script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>
|
|
41
43
|
<script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>
|
|
@@ -54,8 +56,9 @@ import { use } from 'motionary/runtime';
|
|
|
54
56
|
import { gl } from 'motionary/runtime/gl';
|
|
55
57
|
import { formatGltf } from 'motionary/runtime/format-gltf';
|
|
56
58
|
import { formatObj } from 'motionary/runtime/format-obj';
|
|
59
|
+
import { gltfAnim } from 'motionary/runtime/gltf-anim';
|
|
57
60
|
|
|
58
|
-
use(gl, formatGltf, formatObj);
|
|
61
|
+
use(gl, formatGltf, formatObj, gltfAnim);
|
|
59
62
|
import { defineGlScene } from 'motionary/components/widgets';
|
|
60
63
|
|
|
61
64
|
defineGlScene(); // registers <usa-gl-scene>
|
|
@@ -64,3 +67,21 @@ defineGlScene(); // registers <usa-gl-scene>
|
|
|
64
67
|
<usa-gl-scene src="/models/chair.glb" controls auto-rotate="20" label="Chair"></usa-gl-scene>
|
|
65
68
|
*/
|
|
66
69
|
```
|
|
70
|
+
|
|
71
|
+
## Variants
|
|
72
|
+
|
|
73
|
+
### 3D scene (glTF / OBJ)
|
|
74
|
+
|
|
75
|
+
10.5: a WebGL2 3D viewer on Motionary’s own renderer — glTF 2.0 / GLB and OBJ / MTL models or built-in shapes, PBR-style materials, orbit controls (drag, wheel, pinch, arrow keys), auto-rotate and video textures. Requires motionary/runtime/gl (+ format-gltf for .gltf / .glb, format-obj for .obj, gltf-anim for glTF animation — 10.8) — npm i motionary, then use(gl, formatGltf, formatObj, gltfAnim) before it mounts. Alias: <usa-three-scene>.
|
|
76
|
+
|
|
77
|
+
```html
|
|
78
|
+
<usa-gl-scene src="/models/chair.glb" controls auto-rotate="20" label="Chair"></usa-gl-scene>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 3D animation (glTF skin + morph)
|
|
82
|
+
|
|
83
|
+
10.8: <usa-gl-scene animation> plays glTF animations — skeletal skinning (4 joints per vertex), morph targets and LINEAR / STEP / CUBICSPLINE channels — on Motionary’s own WebGL2 renderer. Pick a clip by name or index, set animation-speed; reduced motion shows the first pose. Requires motionary/runtime/gl + motionary/runtime/format-gltf + motionary/runtime/gltf-anim (+ format-obj for .obj models) — npm i motionary, then use(gl, formatGltf, formatObj, gltfAnim).
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<usa-gl-scene src="/models/robot.glb" animation="walk" controls label="Walking robot"></usa-gl-scene>
|
|
87
|
+
```
|
|
@@ -58,3 +58,21 @@ defineLottiePlayer(); // registers <usa-lottie-player>
|
|
|
58
58
|
<usa-lottie-player src="/anim/hero.lottie" autoplay loop label="Hero animation"></usa-lottie-player>
|
|
59
59
|
*/
|
|
60
60
|
```
|
|
61
|
+
|
|
62
|
+
## Variants
|
|
63
|
+
|
|
64
|
+
### Lottie player (JSON + dotLottie)
|
|
65
|
+
|
|
66
|
+
10.6: plays Lottie JSON and dotLottie (.lottie) files with Motionary’s own Canvas 2D renderer — shapes, gradients, trim paths, masks, track mattes, precomps and images; autoplay, loop, bounce, segments / markers, play on hover or scrub with scroll. Requires motionary/runtime/vector — npm i motionary, then use(vector) before it mounts.
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<usa-lottie-player src="/anim/hero.lottie" autoplay loop label="Hero animation"></usa-lottie-player>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Lottie text + expressions
|
|
73
|
+
|
|
74
|
+
10.8: the Lottie player now draws text layers (fonts by family and style, justification, tracking, line height, fill and stroke, wrapping box text, source-text keyframes) and runs an expression subset — time, value, wiggle, loopOut / loopIn, linear / ease, Math — with its own interpreter (no eval, CSP-safe). Requires motionary/runtime/vector — npm i motionary, then use(vector).
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<usa-lottie-player src="/anim/title.json" autoplay loop label="Animated title"></usa-lottie-player>
|
|
78
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# `<usa-motion-prompt>` — Motion prompt (text → motion)
|
|
2
|
+
|
|
3
|
+
> Generated from the source and the gallery catalog by `scripts/gen-component-docs.mjs` (same data as [components.json](https://harrisoncn.github.io/Motionary/components.json) and [llms-full.txt](https://harrisoncn.github.io/Motionary/llms-full.txt)).
|
|
4
|
+
|
|
5
|
+
10.7 (AI-assisted motion): describe a motion in English or Chinese and get a live preview plus ready code — Web Animations, CSS (with a reduced-motion guard) or a Motionary component. A small deterministic parser (motionary/components/ai), no model and no network; the same parser powers suggest_motion in motionary-mcp 2.0.
|
|
6
|
+
|
|
7
|
+
- **Category:** ui · **since** 10.7
|
|
8
|
+
- **Import:** `import { defineMotionPrompt } from 'motionary/components/widgets'` then `defineMotionPrompt();`
|
|
9
|
+
- **CDN:** `<script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>`
|
|
10
|
+
- **Attributes:** `value`, `format`, `placeholder`, `label`
|
|
11
|
+
- **Events:** `usa:suggest`, `usa:copy`
|
|
12
|
+
- **Slots:** —
|
|
13
|
+
- **Methods:** `suggest()`
|
|
14
|
+
- **Source:** [src/components/widgets/motion-prompt.ts](../../src/components/widgets/motion-prompt.ts)
|
|
15
|
+
|
|
16
|
+
## Minimal example
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<usa-motion-prompt value="fade the cards up slowly, one after another"></usa-motion-prompt>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## ES module
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import { defineMotionPrompt } from 'motionary/components/widgets';
|
|
26
|
+
|
|
27
|
+
defineMotionPrompt(); // registers <usa-motion-prompt>
|
|
28
|
+
|
|
29
|
+
/* then use it in your HTML:
|
|
30
|
+
<usa-motion-prompt value="fade the cards up slowly, one after another"></usa-motion-prompt>
|
|
31
|
+
*/
|
|
32
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# `<usa-physics-playground>` — Physics playground
|
|
2
|
+
|
|
3
|
+
> Generated from the source and the gallery catalog by `scripts/gen-component-docs.mjs` (same data as [components.json](https://harrisoncn.github.io/Motionary/components.json) and [llms-full.txt](https://harrisoncn.github.io/Motionary/llms-full.txt)).
|
|
4
|
+
|
|
5
|
+
10.7: a 2D rigid-body sandbox on Motionary’s own physics engine — circles, boxes and polygons, friction, restitution, constraints, sleeping — loaded from a versioned motionary-scene@1 JSON (or a preset: balls, pyramid, pendulum, dominoes). Drag bodies, tap to spawn, arrow keys nudge. Requires motionary/runtime/physics + motionary/runtime/format-scene — npm i motionary, then use(physics, formatScene) before it mounts.
|
|
6
|
+
|
|
7
|
+
- **Category:** ui · **since** 10.7
|
|
8
|
+
- **Import:** `import { definePhysicsPlayground } from 'motionary/components/widgets'` then `definePhysicsPlayground();`
|
|
9
|
+
- **CDN:** `<script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>`
|
|
10
|
+
- **Attributes:** `preset`, `src`, `gravity`, `spawn`, `label`
|
|
11
|
+
- **Events:** `usa:collision`, `usa:load`, `usa:error`, `usa:runtime-missing`
|
|
12
|
+
- **Slots:** —
|
|
13
|
+
- **Methods:** `reset()`, `play()`, `pause()`, `toScene()`
|
|
14
|
+
- **Source:** [src/components/widgets/physics-playground.ts](../../src/components/widgets/physics-playground.ts)
|
|
15
|
+
|
|
16
|
+
## Prerequisites — Requires: motionary/runtime/physics + motionary/runtime/format-scene
|
|
17
|
+
|
|
18
|
+
1. **Install:** `npm i motionary`
|
|
19
|
+
2. **Import order & registration:** Register the core first, then the module: use(physics) also registers the core. CDN: load runtime.iife.js, then runtime/physics.iife.js (it registers itself). Register the core first, then the module: use(formatScene) also registers the core. CDN: load runtime.iife.js, then runtime/format-scene.iife.js (it registers itself).
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import { use } from 'motionary/runtime';
|
|
23
|
+
import { physics } from 'motionary/runtime/physics';
|
|
24
|
+
import { formatScene } from 'motionary/runtime/format-scene';
|
|
25
|
+
import { definePhysicsPlayground } from 'motionary/components/widgets';
|
|
26
|
+
|
|
27
|
+
use(physics, formatScene);
|
|
28
|
+
definePhysicsPlayground(); // registers <usa-physics-playground> — after the prerequisites
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
3. **CDN:**
|
|
32
|
+
|
|
33
|
+
```html
|
|
34
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
|
|
35
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/physics.iife.js"></script>
|
|
36
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-scene.iife.js"></script>
|
|
37
|
+
<!-- then the component bundles -->
|
|
38
|
+
<script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>
|
|
39
|
+
<script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Minimal example
|
|
43
|
+
|
|
44
|
+
```html
|
|
45
|
+
<usa-physics-playground preset="pyramid" spawn label="Knock the pyramid over"></usa-physics-playground>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## ES module
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
import { use } from 'motionary/runtime';
|
|
52
|
+
import { physics } from 'motionary/runtime/physics';
|
|
53
|
+
import { formatScene } from 'motionary/runtime/format-scene';
|
|
54
|
+
|
|
55
|
+
use(physics, formatScene);
|
|
56
|
+
import { definePhysicsPlayground } from 'motionary/components/widgets';
|
|
57
|
+
|
|
58
|
+
definePhysicsPlayground(); // registers <usa-physics-playground>
|
|
59
|
+
|
|
60
|
+
/* then use it in your HTML:
|
|
61
|
+
<usa-physics-playground preset="pyramid" spawn label="Knock the pyramid over"></usa-physics-playground>
|
|
62
|
+
*/
|
|
63
|
+
```
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# `<usa-snap-carousel>` — Snap carousel (drag · inertia · snap)
|
|
2
|
+
|
|
3
|
+
> Generated from the source and the gallery catalog by `scripts/gen-component-docs.mjs` (same data as [components.json](https://harrisoncn.github.io/Motionary/components.json) and [llms-full.txt](https://harrisoncn.github.io/Motionary/llms-full.txt)).
|
|
4
|
+
|
|
5
|
+
10.8: drag or swipe with real inertia — a throw keeps gliding, then springs to the nearest slide (a quick flick always moves one); rubber-band edges, arrows, dots, ←/→ / Home / End, optional autoplay that pauses on hover, focus and off screen. Slides keep their own width so the next one peeks in. Requires motionary/runtime/drag-snap — npm i motionary, then use(dragSnap) before it mounts. Its own entry point: motionary/components/snap-carousel (not in the widgets / lite bundles).
|
|
6
|
+
|
|
7
|
+
- **Category:** ui · **since** 10.8
|
|
8
|
+
- **Import:** `import { defineSnapCarousel } from 'motionary/components/snap-carousel'` then `defineSnapCarousel();`
|
|
9
|
+
- **CDN:** `<script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>`
|
|
10
|
+
- **Attributes:** `align`, `gap`, `autoplay`, `no-controls`, `no-dots`, `label`
|
|
11
|
+
- **Events:** `usa:change`, `usa:runtime-missing`
|
|
12
|
+
- **Slots:** —
|
|
13
|
+
- **Methods:** `next()`, `prev()`, `goTo()`
|
|
14
|
+
- **Source:** [src/components/widgets/snap-carousel.ts](../../src/components/widgets/snap-carousel.ts)
|
|
15
|
+
|
|
16
|
+
## Prerequisites — Requires: motionary/runtime/drag-snap
|
|
17
|
+
|
|
18
|
+
1. **Install:** `npm i motionary`
|
|
19
|
+
2. **Import order & registration:** Register the core first, then the module: use(dragSnap) also registers the core. CDN: load runtime.iife.js, then runtime/drag-snap.iife.js (it registers itself).
|
|
20
|
+
|
|
21
|
+
```js
|
|
22
|
+
import { use } from 'motionary/runtime';
|
|
23
|
+
import { dragSnap } from 'motionary/runtime/drag-snap';
|
|
24
|
+
import { defineSnapCarousel } from 'motionary/components/snap-carousel';
|
|
25
|
+
|
|
26
|
+
use(dragSnap);
|
|
27
|
+
defineSnapCarousel(); // registers <usa-snap-carousel> — after the prerequisites
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
3. **CDN:**
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
|
|
34
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/drag-snap.iife.js"></script>
|
|
35
|
+
<!-- then the component bundles -->
|
|
36
|
+
<script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>
|
|
37
|
+
<script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Minimal example
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<usa-snap-carousel align="center" gap="16" label="Featured">
|
|
44
|
+
<article>…</article>
|
|
45
|
+
<article>…</article>
|
|
46
|
+
<article>…</article>
|
|
47
|
+
</usa-snap-carousel>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## ES module
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
import { use } from 'motionary/runtime';
|
|
54
|
+
import { dragSnap } from 'motionary/runtime/drag-snap';
|
|
55
|
+
|
|
56
|
+
use(dragSnap);
|
|
57
|
+
import { defineSnapCarousel } from 'motionary/components/snap-carousel';
|
|
58
|
+
|
|
59
|
+
defineSnapCarousel(); // registers <usa-snap-carousel>
|
|
60
|
+
|
|
61
|
+
/* then use it in your HTML:
|
|
62
|
+
<usa-snap-carousel align="center" gap="16" label="Featured">
|
|
63
|
+
<article>…</article>
|
|
64
|
+
<article>…</article>
|
|
65
|
+
<article>…</article>
|
|
66
|
+
</usa-snap-carousel>
|
|
67
|
+
*/
|
|
68
|
+
```
|
package/docs/components.md
CHANGED
|
@@ -1467,19 +1467,20 @@ defineSmoothScroll(); // registers <usa-smooth-scroll> — after the prerequisit
|
|
|
1467
1467
|
<usa-smooth-scroll lerp="0.1" offset="64"></usa-smooth-scroll>
|
|
1468
1468
|
```
|
|
1469
1469
|
|
|
1470
|
-
### `<usa-gl-scene>` — Requires: motionary/runtime/gl + motionary/runtime/format-gltf + motionary/runtime/format-obj
|
|
1470
|
+
### `<usa-gl-scene>` — Requires: motionary/runtime/gl + motionary/runtime/format-gltf + motionary/runtime/format-obj + motionary/runtime/gltf-anim
|
|
1471
1471
|
|
|
1472
1472
|
- **Install:** `npm i motionary`
|
|
1473
|
-
- **Import order & registration:** Register the core first, then the module: use(gl) also registers the core. CDN: load runtime.iife.js, then runtime/gl.iife.js (it registers itself). Register the core first, then the module: use(formatGltf) also registers the core. CDN: load runtime.iife.js, then runtime/format-gltf.iife.js (it registers itself). Register the core first, then the module: use(formatObj) also registers the core. CDN: load runtime.iife.js, then runtime/format-obj.iife.js (it registers itself).
|
|
1473
|
+
- **Import order & registration:** Register the core first, then the module: use(gl) also registers the core. CDN: load runtime.iife.js, then runtime/gl.iife.js (it registers itself). Register the core first, then the module: use(formatGltf) also registers the core. CDN: load runtime.iife.js, then runtime/format-gltf.iife.js (it registers itself). Register the core first, then the module: use(formatObj) also registers the core. CDN: load runtime.iife.js, then runtime/format-obj.iife.js (it registers itself). Register the core first, then the module: use(gltfAnim) also registers the core. CDN: load runtime.iife.js, then runtime/gltf-anim.iife.js (it registers itself).
|
|
1474
1474
|
|
|
1475
1475
|
```js
|
|
1476
1476
|
import { use } from 'motionary/runtime';
|
|
1477
1477
|
import { gl } from 'motionary/runtime/gl';
|
|
1478
1478
|
import { formatGltf } from 'motionary/runtime/format-gltf';
|
|
1479
1479
|
import { formatObj } from 'motionary/runtime/format-obj';
|
|
1480
|
+
import { gltfAnim } from 'motionary/runtime/gltf-anim';
|
|
1480
1481
|
import { defineGlScene } from 'motionary/components/widgets';
|
|
1481
1482
|
|
|
1482
|
-
use(gl, formatGltf, formatObj);
|
|
1483
|
+
use(gl, formatGltf, formatObj, gltfAnim);
|
|
1483
1484
|
defineGlScene(); // registers <usa-gl-scene> — after the prerequisites
|
|
1484
1485
|
```
|
|
1485
1486
|
|
|
@@ -1490,6 +1491,7 @@ defineGlScene(); // registers <usa-gl-scene> — after the prerequisites
|
|
|
1490
1491
|
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/gl.iife.js"></script>
|
|
1491
1492
|
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-gltf.iife.js"></script>
|
|
1492
1493
|
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-obj.iife.js"></script>
|
|
1494
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/gltf-anim.iife.js"></script>
|
|
1493
1495
|
<!-- then the component bundles -->
|
|
1494
1496
|
<script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>
|
|
1495
1497
|
<script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>
|
|
@@ -1559,6 +1561,72 @@ defineRive(); // registers <usa-rive> — after the prerequisites
|
|
|
1559
1561
|
<usa-rive src="/anim/icon.riv" state-machine="State Machine 1" autoplay label="Icon"></usa-rive>
|
|
1560
1562
|
```
|
|
1561
1563
|
|
|
1564
|
+
### `<usa-physics-playground>` — Requires: motionary/runtime/physics + motionary/runtime/format-scene
|
|
1565
|
+
|
|
1566
|
+
- **Install:** `npm i motionary`
|
|
1567
|
+
- **Import order & registration:** Register the core first, then the module: use(physics) also registers the core. CDN: load runtime.iife.js, then runtime/physics.iife.js (it registers itself). Register the core first, then the module: use(formatScene) also registers the core. CDN: load runtime.iife.js, then runtime/format-scene.iife.js (it registers itself).
|
|
1568
|
+
|
|
1569
|
+
```js
|
|
1570
|
+
import { use } from 'motionary/runtime';
|
|
1571
|
+
import { physics } from 'motionary/runtime/physics';
|
|
1572
|
+
import { formatScene } from 'motionary/runtime/format-scene';
|
|
1573
|
+
import { definePhysicsPlayground } from 'motionary/components/widgets';
|
|
1574
|
+
|
|
1575
|
+
use(physics, formatScene);
|
|
1576
|
+
definePhysicsPlayground(); // registers <usa-physics-playground> — after the prerequisites
|
|
1577
|
+
```
|
|
1578
|
+
|
|
1579
|
+
- **CDN:**
|
|
1580
|
+
|
|
1581
|
+
```html
|
|
1582
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
|
|
1583
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/physics.iife.js"></script>
|
|
1584
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-scene.iife.js"></script>
|
|
1585
|
+
<!-- then the component bundles -->
|
|
1586
|
+
<script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>
|
|
1587
|
+
<script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>
|
|
1588
|
+
```
|
|
1589
|
+
|
|
1590
|
+
- **Minimal example:**
|
|
1591
|
+
|
|
1592
|
+
```html
|
|
1593
|
+
<usa-physics-playground preset="pyramid" spawn label="Knock the pyramid over"></usa-physics-playground>
|
|
1594
|
+
```
|
|
1595
|
+
|
|
1596
|
+
### `<usa-snap-carousel>` — Requires: motionary/runtime/drag-snap
|
|
1597
|
+
|
|
1598
|
+
- **Install:** `npm i motionary`
|
|
1599
|
+
- **Import order & registration:** Register the core first, then the module: use(dragSnap) also registers the core. CDN: load runtime.iife.js, then runtime/drag-snap.iife.js (it registers itself).
|
|
1600
|
+
|
|
1601
|
+
```js
|
|
1602
|
+
import { use } from 'motionary/runtime';
|
|
1603
|
+
import { dragSnap } from 'motionary/runtime/drag-snap';
|
|
1604
|
+
import { defineSnapCarousel } from 'motionary/components/snap-carousel';
|
|
1605
|
+
|
|
1606
|
+
use(dragSnap);
|
|
1607
|
+
defineSnapCarousel(); // registers <usa-snap-carousel> — after the prerequisites
|
|
1608
|
+
```
|
|
1609
|
+
|
|
1610
|
+
- **CDN:**
|
|
1611
|
+
|
|
1612
|
+
```html
|
|
1613
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
|
|
1614
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/drag-snap.iife.js"></script>
|
|
1615
|
+
<!-- then the component bundles -->
|
|
1616
|
+
<script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>
|
|
1617
|
+
<script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>
|
|
1618
|
+
```
|
|
1619
|
+
|
|
1620
|
+
- **Minimal example:**
|
|
1621
|
+
|
|
1622
|
+
```html
|
|
1623
|
+
<usa-snap-carousel align="center" gap="16" label="Featured">
|
|
1624
|
+
<article>…</article>
|
|
1625
|
+
<article>…</article>
|
|
1626
|
+
<article>…</article>
|
|
1627
|
+
</usa-snap-carousel>
|
|
1628
|
+
```
|
|
1629
|
+
|
|
1562
1630
|
<!-- prereqs:end -->
|
|
1563
1631
|
|
|
1564
1632
|
### v10.2 Scroll scenes (`motionary/runtime/scroll`) + SVG loader + `data-motion` in core: `<usa-scroll-scene>`, `<usa-motion-inspector>` (`components/widgets`)
|
|
@@ -1640,6 +1708,30 @@ MCP: `npx -y -p motionary motionary-mcp` — see [docs/mcp.md](docs/mcp.md).
|
|
|
1640
1708
|
| `<usa-rive>` (Requires: @rive-app/canvas — official runtime, optional peer) | `src`, `artboard`, `animation`, `state-machine`, `autoplay`, `fit` (contain, cover, fill, fitWidth, fitHeight, none), `runtime-src`, `label` | `rive`, `play()`, `pause()`, `input(name)`; `usa:load`, `usa:error`, `usa:runtime-missing`; `provideRiveRuntime(loader)` |
|
|
1641
1709
|
| `<usa-token-editor>` | `apply`, `format` (2025.10, draft), `groups` (duration, easing), `label` | `tokens`, `exportJSON()`, `importJSON(json)`; `usa:change`, `usa:export`, `usa:import` |
|
|
1642
1710
|
|
|
1711
|
+
### v10.7 AI-assisted motion and physics: `<usa-physics-playground>`, `<usa-motion-prompt>` (`components/widgets`), `motionary/components/ai`, `motionary/runtime/physics` + `format-scene`
|
|
1712
|
+
|
|
1713
|
+
```html
|
|
1714
|
+
<usa-physics-playground preset="pyramid" spawn label="Knock the pyramid over"></usa-physics-playground>
|
|
1715
|
+
<usa-motion-prompt value="fade the cards up slowly, one after another"></usa-motion-prompt>
|
|
1716
|
+
```
|
|
1717
|
+
|
|
1718
|
+
| Element | Attributes | Methods / events |
|
|
1719
|
+
|---|---|---|
|
|
1720
|
+
| `<usa-physics-playground>` (Requires: motionary/runtime/physics + motionary/runtime/format-scene) | `preset` (balls, pyramid, pendulum, dominoes), `src` (scene JSON) or inline `<script type="application/json">`, `gravity`, `spawn`, `paused`, `label` | `world`, `bodies`, `scene`, `toScene()`, `reset()`, `play()`, `pause()`; `usa:load`, `usa:collision`, `usa:error`, `usa:runtime-missing` |
|
|
1721
|
+
| `<usa-motion-prompt>` | `value`, `format` (waapi, css, component), `placeholder`, `label` | `intent`, `suggest(text)`; `usa:suggest`, `usa:copy` |
|
|
1722
|
+
|
|
1723
|
+
### v10.8 drag-snap + `<usa-snap-carousel>`, glTF animation (`motionary/runtime/gltf-anim`), Lottie text + expressions
|
|
1724
|
+
|
|
1725
|
+
```html
|
|
1726
|
+
<usa-snap-carousel align="center" label="Featured"><article>…</article><article>…</article></usa-snap-carousel>
|
|
1727
|
+
<usa-gl-scene src="/models/robot.glb" animation="walk" controls label="Walking robot"></usa-gl-scene>
|
|
1728
|
+
```
|
|
1729
|
+
|
|
1730
|
+
| Element | Attributes | Methods / events |
|
|
1731
|
+
|---|---|---|
|
|
1732
|
+
| `<usa-snap-carousel>` (`motionary/components/snap-carousel`; Requires: motionary/runtime/drag-snap) | `align` (center, start), `gap`, `index`, `autoplay`, `no-controls`, `no-dots`, `label` | `index`, `length`, `controller`, `next()`, `prev()`, `goTo(i, animate)`; `usa:change`, `usa:runtime-missing` |
|
|
1733
|
+
| `<usa-gl-scene>` (10.8 additions; animation Requires: motionary/runtime/gltf-anim) | `animation` (clip name / index), `animation-speed` | `animator`; `usa:load` { animations } |
|
|
1734
|
+
|
|
1643
1735
|
## Frameworks
|
|
1644
1736
|
|
|
1645
1737
|
Custom elements work in every framework. Register once (e.g. in your entry file), then use the tags.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# motionary/runtime/drag-snap — Drag, inertia and snap points
|
|
2
|
+
|
|
3
|
+
> Generated from `showcase/catalog/prereqs.js` by `scripts/gen-runtime-docs.mjs` — edit the data, not this page.
|
|
4
|
+
|
|
5
|
+
Pointer drag along one axis with velocity tracking, inertial throws, rubber-band edges and spring-animated snap points on the shared ticker — the engine of <usa-snap-carousel>, usable for sheets, sliders and pickers (own implementation).
|
|
6
|
+
|
|
7
|
+
Part of Motionary's own zero-dependency runtime. Size budget: **4.0 KB gzip** (enforced in CI).
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
1. **Install:** `npm i motionary`
|
|
12
|
+
2. **Import path:** `motionary/runtime/drag-snap`
|
|
13
|
+
3. **CDN:**
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
|
|
17
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/drag-snap.iife.js"></script>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
ESM from a CDN: `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/drag-snap.js`
|
|
21
|
+
|
|
22
|
+
4. **Import order & registration:** Register the core first, then the module: use(dragSnap) also registers the core. CDN: load runtime.iife.js, then runtime/drag-snap.iife.js (it registers itself).
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import { use } from 'motionary/runtime';
|
|
26
|
+
import { dragSnap } from 'motionary/runtime/drag-snap';
|
|
27
|
+
use(dragSnap);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import { use } from 'motionary/runtime';
|
|
34
|
+
import { dragSnap, createDragSnap } from 'motionary/runtime/drag-snap';
|
|
35
|
+
use(dragSnap);
|
|
36
|
+
const track = document.querySelector('.track');
|
|
37
|
+
const ds = createDragSnap(track, { axis: 'x', snap: [0, -320, -640], onUpdate: (x) => (track.style.transform = `translateX(${x}px)`) });
|
|
38
|
+
ds.snapTo(1);
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Exports
|
|
42
|
+
|
|
43
|
+
`dragSnap` · `createDragSnap` · `projectThrow` · `nearestSnap` · `rubberband` · `springStep` · `velocityTracker`
|
|
44
|
+
|
|
45
|
+
## Compatibility
|
|
46
|
+
|
|
47
|
+
| Feature | Supported | Notes |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| pointer, touch and pen (Pointer Events), drag threshold, pointer capture, touch-action for the other axis | ✅ yes | one axis per controller (x or y) |
|
|
50
|
+
| velocity from the last 100 ms, inertial throw with constant deceleration | ✅ yes | off under reduced motion |
|
|
51
|
+
| snap points: nearest to the projected throw, a fast flick moves at least one point | ✅ yes | |
|
|
52
|
+
| critically damped spring to the snap point (shared ticker) | ✅ yes | instant under reduced motion |
|
|
53
|
+
| bounds with rubber-band resistance | ✅ yes | |
|
|
54
|
+
| clicks inside are kept; the click that ends a drag is swallowed | ✅ yes | |
|
|
55
|
+
| free 2D dragging, scroll-linked snapping (CSS scroll-snap) | ✕ no | use two controllers / native scroll-snap |
|
|
56
|
+
| SSR / workers | ◐ partial | the maths (projectThrow, nearestSnap, rubberband, springStep, velocityTracker) is pure |
|
|
57
|
+
|
|
58
|
+
## Components that need it
|
|
59
|
+
|
|
60
|
+
- `<usa-snap-carousel>` — Snap carousel (drag · inertia · snap)
|
|
@@ -53,9 +53,10 @@ const r = createRenderer(canvas); r.resize(); r.render(scene, cam);
|
|
|
53
53
|
| POSITION / NORMAL / TEXCOORD_0, indices, all component types, normalised ints, byteStride | ✅ yes | missing normals computed (flat) |
|
|
54
54
|
| primitive modes points / lines / triangles / strips / fans | ✅ yes | strips and fans converted to triangles |
|
|
55
55
|
| PBR metallic-roughness factors, base colour texture, emissive, alpha blend, double-sided | ✅ yes | KHR_materials_emissive_strength, KHR_materials_unlit |
|
|
56
|
-
| skins, morph targets, animations |
|
|
56
|
+
| skins, morph targets, animations | ✅ yes | data kept on the nodes / geometry; played by motionary/runtime/gltf-anim (10.8) |
|
|
57
|
+
| sparse accessors | ✅ yes | 10.8 |
|
|
57
58
|
| Draco / meshopt / KTX2 (Basis) compression | ✕ no | files that require them fail with a clear error; decoder hooks planned for 10.9 |
|
|
58
|
-
|
|
|
59
|
+
| cameras, KHR_lights_punctual, texture transforms | ✕ no | ignored |
|
|
59
60
|
| SSR / workers | ◐ partial | parseGlb / gltfToNode are pure; loadGltf decodes images with createImageBitmap |
|
|
60
61
|
|
|
61
62
|
## Components that need it
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# motionary/runtime/format-scene — Scene JSON (motionary-scene@1)
|
|
2
|
+
|
|
3
|
+
> Generated from `showcase/catalog/prereqs.js` by `scripts/gen-runtime-docs.mjs` — edit the data, not this page.
|
|
4
|
+
|
|
5
|
+
The versioned motionary-scene@1 format: a JSON description of a 2D physics scene (world, named materials, bodies, constraints, per-body style) — validate, migrate older drafts, load into a physics world and save one back.
|
|
6
|
+
|
|
7
|
+
Part of Motionary's own zero-dependency runtime. Size budget: **3.0 KB gzip** (enforced in CI).
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
1. **Install:** `npm i motionary`
|
|
12
|
+
2. **Import path:** `motionary/runtime/format-scene`
|
|
13
|
+
3. **CDN:**
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
|
|
17
|
+
<script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-scene.iife.js"></script>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
ESM from a CDN: `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-scene.js`
|
|
21
|
+
|
|
22
|
+
4. **Import order & registration:** Register the core first, then the module: use(formatScene) also registers the core. CDN: load runtime.iife.js, then runtime/format-scene.iife.js (it registers itself).
|
|
23
|
+
|
|
24
|
+
```js
|
|
25
|
+
import { use } from 'motionary/runtime';
|
|
26
|
+
import { formatScene } from 'motionary/runtime/format-scene';
|
|
27
|
+
use(formatScene);
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import { use } from 'motionary/runtime';
|
|
34
|
+
import { physics } from 'motionary/runtime/physics';
|
|
35
|
+
import { formatScene, sceneToWorld } from 'motionary/runtime/format-scene';
|
|
36
|
+
use(physics, formatScene);
|
|
37
|
+
const { world, bodies } = sceneToWorld(await (await fetch('/scenes/stack.json')).json());
|
|
38
|
+
world.run();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Exports
|
|
42
|
+
|
|
43
|
+
`formatScene` · `SCENE_FORMAT` · `migrateScene` · `validateScene` · `parseScene` · `sceneToWorld` · `worldToScene`
|
|
44
|
+
|
|
45
|
+
## Compatibility
|
|
46
|
+
|
|
47
|
+
| Feature | Supported | Notes |
|
|
48
|
+
|---|---|---|
|
|
49
|
+
| world: size, gravity, walls (with or without a top), solver iterations | ✅ yes | |
|
|
50
|
+
| named materials (restitution, friction, density), per-body overrides | ✅ yes | |
|
|
51
|
+
| bodies: circle / box / polygon, static / kinematic, velocity, angle, sensor, style | ✅ yes | |
|
|
52
|
+
| constraints: distance / spring / pin between bodies or to a world point | ✅ yes | |
|
|
53
|
+
| validation (lists every problem, never throws) + parseScene (throws one error) | ✅ yes | |
|
|
54
|
+
| migration: unversioned scenes and the motionary-scene@0 draft → @1, with a change list | ✅ yes | |
|
|
55
|
+
| save: worldToScene() (walls made by bounds() are left out) | ✅ yes | |
|
|
56
|
+
|
|
57
|
+
## Components that need it
|
|
58
|
+
|
|
59
|
+
- `<usa-physics-playground>` — Physics playground
|