motionary 10.6.0 → 10.7.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.
Files changed (99) hide show
  1. package/AGENTS.md +2 -0
  2. package/CHANGELOG.md +16 -0
  3. package/README.md +35 -1
  4. package/bin/motionary-mcp.mjs +160 -11
  5. package/dist/chunks/{anim-image-DECLkPH4.cjs → anim-image-CFGpUX7t.cjs} +2 -2
  6. package/dist/chunks/{anim-image-DECLkPH4.cjs.map → anim-image-CFGpUX7t.cjs.map} +1 -1
  7. package/dist/chunks/{anim-image-DNghy017.js → anim-image-CXDD19FH.js} +2 -2
  8. package/dist/chunks/{anim-image-DNghy017.js.map → anim-image-CXDD19FH.js.map} +1 -1
  9. package/dist/chunks/{keyframes-CbUZjD_5.cjs → keyframes-DdwGY1gr.cjs} +2 -2
  10. package/dist/chunks/{keyframes-CbUZjD_5.cjs.map → keyframes-DdwGY1gr.cjs.map} +1 -1
  11. package/dist/chunks/{keyframes-F6vp6tZZ.js → keyframes-DwR6GPej.js} +2 -2
  12. package/dist/chunks/{keyframes-F6vp6tZZ.js.map → keyframes-DwR6GPej.js.map} +1 -1
  13. package/dist/chunks/{registry-D8LAoXI-.js → registry-D87dP_aR.js} +3 -3
  14. package/dist/chunks/{registry-D8LAoXI-.js.map → registry-D87dP_aR.js.map} +1 -1
  15. package/dist/chunks/{registry-dr1CPTk1.cjs → registry-DhKZCitb.cjs} +2 -2
  16. package/dist/chunks/{registry-dr1CPTk1.cjs.map → registry-DhKZCitb.cjs.map} +1 -1
  17. package/dist/chunks/{ticker-Do9bGsaV.js → ticker-CJYI5Pxc.js} +2 -2
  18. package/dist/chunks/{ticker-Do9bGsaV.js.map → ticker-CJYI5Pxc.js.map} +1 -1
  19. package/dist/chunks/{ticker-DaAlEyOd.cjs → ticker-jD9_A9Rh.cjs} +2 -2
  20. package/dist/chunks/{ticker-DaAlEyOd.cjs.map → ticker-jD9_A9Rh.cjs.map} +1 -1
  21. package/dist/chunks/{tween-CmkdSyaC.cjs → tween-Dk0QmNe9.cjs} +2 -2
  22. package/dist/chunks/{tween-CmkdSyaC.cjs.map → tween-Dk0QmNe9.cjs.map} +1 -1
  23. package/dist/chunks/{tween-BzCGq_Ba.js → tween-_Lld1MsF.js} +2 -2
  24. package/dist/chunks/{tween-BzCGq_Ba.js.map → tween-_Lld1MsF.js.map} +1 -1
  25. package/dist/components/ai.cjs +314 -0
  26. package/dist/components/ai.cjs.map +1 -0
  27. package/dist/components/ai.d.cts +58 -0
  28. package/dist/components/ai.d.ts +58 -0
  29. package/dist/components/ai.js +311 -0
  30. package/dist/components/ai.js.map +1 -0
  31. package/dist/components/widgets.cjs +598 -226
  32. package/dist/components/widgets.cjs.map +1 -1
  33. package/dist/components/widgets.d.cts +438 -35
  34. package/dist/components/widgets.d.ts +438 -35
  35. package/dist/components/widgets.js +596 -227
  36. package/dist/components/widgets.js.map +1 -1
  37. package/dist/llms-full.txt +98 -1
  38. package/dist/llms.txt +6 -2
  39. package/dist/manifest.json +238 -1
  40. package/dist/runtime/format-apng.cjs +4 -4
  41. package/dist/runtime/format-apng.js +4 -4
  42. package/dist/runtime/format-css.cjs +4 -4
  43. package/dist/runtime/format-css.js +4 -4
  44. package/dist/runtime/format-gif.cjs +4 -4
  45. package/dist/runtime/format-gif.js +4 -4
  46. package/dist/runtime/format-gltf.cjs +1 -1
  47. package/dist/runtime/format-gltf.js +1 -1
  48. package/dist/runtime/format-motion.cjs +4 -4
  49. package/dist/runtime/format-motion.js +4 -4
  50. package/dist/runtime/format-obj.cjs +1 -1
  51. package/dist/runtime/format-obj.js +1 -1
  52. package/dist/runtime/format-scene.cjs +241 -0
  53. package/dist/runtime/format-scene.cjs.map +1 -0
  54. package/dist/runtime/format-scene.d.cts +349 -0
  55. package/dist/runtime/format-scene.d.ts +349 -0
  56. package/dist/runtime/format-scene.iife.js +2 -0
  57. package/dist/runtime/format-scene.iife.js.map +1 -0
  58. package/dist/runtime/format-scene.js +233 -0
  59. package/dist/runtime/format-scene.js.map +1 -0
  60. package/dist/runtime/format-sprite.cjs +3 -3
  61. package/dist/runtime/format-sprite.js +3 -3
  62. package/dist/runtime/format-svg.cjs +3 -3
  63. package/dist/runtime/format-svg.js +3 -3
  64. package/dist/runtime/format-webp.cjs +4 -4
  65. package/dist/runtime/format-webp.js +4 -4
  66. package/dist/runtime/gl.cjs +1 -1
  67. package/dist/runtime/gl.js +1 -1
  68. package/dist/runtime/physics.cjs +739 -0
  69. package/dist/runtime/physics.cjs.map +1 -0
  70. package/dist/runtime/physics.d.cts +250 -0
  71. package/dist/runtime/physics.d.ts +250 -0
  72. package/dist/runtime/physics.iife.js +2 -0
  73. package/dist/runtime/physics.iife.js.map +1 -0
  74. package/dist/runtime/physics.js +731 -0
  75. package/dist/runtime/physics.js.map +1 -0
  76. package/dist/runtime/scroll.cjs +2 -2
  77. package/dist/runtime/scroll.js +2 -2
  78. package/dist/runtime/smooth.cjs +1 -1
  79. package/dist/runtime/smooth.js +1 -1
  80. package/dist/runtime/text.cjs +1 -1
  81. package/dist/runtime/text.js +1 -1
  82. package/dist/runtime/vector.cjs +3 -3
  83. package/dist/runtime/vector.js +3 -3
  84. package/dist/runtime.cjs +3 -3
  85. package/dist/runtime.d.cts +1 -1
  86. package/dist/runtime.d.ts +1 -1
  87. package/dist/runtime.iife.js +1 -1
  88. package/dist/runtime.iife.js.map +1 -1
  89. package/dist/runtime.js +5 -5
  90. package/dist/widgets.umd.js +1 -1
  91. package/dist/widgets.umd.js.map +1 -1
  92. package/docs/ROADMAP.md +1 -1
  93. package/docs/components/README.md +3 -1
  94. package/docs/components/usa-motion-prompt.md +32 -0
  95. package/docs/components/usa-physics-playground.md +63 -0
  96. package/docs/components.md +44 -0
  97. package/docs/runtime/format-scene.md +59 -0
  98. package/docs/runtime/physics.md +61 -0
  99. package/package.json +31 -1
package/docs/ROADMAP.md CHANGED
@@ -69,7 +69,7 @@ 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>`。
@@ -1,4 +1,4 @@
1
- # Motionary components (205)
1
+ # Motionary components (207)
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
 
@@ -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
@@ -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
+ ```
@@ -1559,6 +1559,38 @@ defineRive(); // registers <usa-rive> — after the prerequisites
1559
1559
  <usa-rive src="/anim/icon.riv" state-machine="State Machine 1" autoplay label="Icon"></usa-rive>
1560
1560
  ```
1561
1561
 
1562
+ ### `<usa-physics-playground>` — Requires: motionary/runtime/physics + motionary/runtime/format-scene
1563
+
1564
+ - **Install:** `npm i motionary`
1565
+ - **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).
1566
+
1567
+ ```js
1568
+ import { use } from 'motionary/runtime';
1569
+ import { physics } from 'motionary/runtime/physics';
1570
+ import { formatScene } from 'motionary/runtime/format-scene';
1571
+ import { definePhysicsPlayground } from 'motionary/components/widgets';
1572
+
1573
+ use(physics, formatScene);
1574
+ definePhysicsPlayground(); // registers <usa-physics-playground> — after the prerequisites
1575
+ ```
1576
+
1577
+ - **CDN:**
1578
+
1579
+ ```html
1580
+ <script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime.iife.js"></script>
1581
+ <script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/physics.iife.js"></script>
1582
+ <script src="https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/format-scene.iife.js"></script>
1583
+ <!-- then the component bundles -->
1584
+ <script src="https://unpkg.com/motionary@10/dist/components.umd.js"></script>
1585
+ <script src="https://unpkg.com/motionary@10/dist/widgets.umd.js"></script>
1586
+ ```
1587
+
1588
+ - **Minimal example:**
1589
+
1590
+ ```html
1591
+ <usa-physics-playground preset="pyramid" spawn label="Knock the pyramid over"></usa-physics-playground>
1592
+ ```
1593
+
1562
1594
  <!-- prereqs:end -->
1563
1595
 
1564
1596
  ### v10.2 Scroll scenes (`motionary/runtime/scroll`) + SVG loader + `data-motion` in core: `<usa-scroll-scene>`, `<usa-motion-inspector>` (`components/widgets`)
@@ -1640,6 +1672,18 @@ MCP: `npx -y -p motionary motionary-mcp` — see [docs/mcp.md](docs/mcp.md).
1640
1672
  | `<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
1673
  | `<usa-token-editor>` | `apply`, `format` (2025.10, draft), `groups` (duration, easing), `label` | `tokens`, `exportJSON()`, `importJSON(json)`; `usa:change`, `usa:export`, `usa:import` |
1642
1674
 
1675
+ ### v10.7 AI-assisted motion and physics: `<usa-physics-playground>`, `<usa-motion-prompt>` (`components/widgets`), `motionary/components/ai`, `motionary/runtime/physics` + `format-scene`
1676
+
1677
+ ```html
1678
+ <usa-physics-playground preset="pyramid" spawn label="Knock the pyramid over"></usa-physics-playground>
1679
+ <usa-motion-prompt value="fade the cards up slowly, one after another"></usa-motion-prompt>
1680
+ ```
1681
+
1682
+ | Element | Attributes | Methods / events |
1683
+ |---|---|---|
1684
+ | `<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` |
1685
+ | `<usa-motion-prompt>` | `value`, `format` (waapi, css, component), `placeholder`, `label` | `intent`, `suggest(text)`; `usa:suggest`, `usa:copy` |
1686
+
1643
1687
  ## Frameworks
1644
1688
 
1645
1689
  Custom elements work in every framework. Register once (e.g. in your entry file), then use the tags.
@@ -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
@@ -0,0 +1,61 @@
1
+ # motionary/runtime/physics — 2D rigid-body physics
2
+
3
+ > Generated from `showcase/catalog/prereqs.js` by `scripts/gen-runtime-docs.mjs` — edit the data, not this page.
4
+
5
+ A small 2D rigid-body engine written for Motionary (own implementation and API — no Matter.js / Box2D code): circles, boxes and convex polygons, mass from density, restitution, friction, sensors, collision groups, sleeping, distance / spring / pin constraints, pointer drag, a fixed time step on the shared ticker.
6
+
7
+ Part of Motionary's own zero-dependency runtime. Size budget: **10.0 KB gzip** (enforced in CI).
8
+
9
+ ## Prerequisites
10
+
11
+ 1. **Install:** `npm i motionary`
12
+ 2. **Import path:** `motionary/runtime/physics`
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/physics.iife.js"></script>
18
+ ```
19
+
20
+ ESM from a CDN: `https://cdn.jsdelivr.net/npm/motionary@10/dist/runtime/physics.js`
21
+
22
+ 4. **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).
23
+
24
+ ```js
25
+ import { use } from 'motionary/runtime';
26
+ import { physics } from 'motionary/runtime/physics';
27
+ use(physics);
28
+ ```
29
+
30
+ ## Example
31
+
32
+ ```js
33
+ import { use } from 'motionary/runtime';
34
+ import { physics, createWorld } from 'motionary/runtime/physics';
35
+ use(physics);
36
+ const world = createWorld({ gravity: [0, 980] });
37
+ world.bounds(600, 400);
38
+ const ball = world.body({ shape: 'circle', x: 300, y: 40, radius: 20, restitution: 0.7 });
39
+ world.run(); // steps on the shared ticker
40
+ ```
41
+
42
+ ## Exports
43
+
44
+ `physics` · `createWorld` · `World` · `Body` · `Constraint` · `collide` · `dragConstraint`
45
+
46
+ ## Compatibility
47
+
48
+ | Feature | Supported | Notes |
49
+ |---|---|---|
50
+ | bodies: circle, box, convex polygon (any winding, made convex) | ✅ yes | concave shapes: split them into convex parts |
51
+ | static, dynamic and kinematic bodies; density / mass, inertia, fixed rotation | ✅ yes | |
52
+ | collisions: sort-and-sweep broad phase, SAT narrow phase, up to 2 contact points | ✅ yes | no continuous collision detection: very fast small bodies can tunnel |
53
+ | restitution, Coulomb friction, warm-started accumulated impulses | ✅ yes | |
54
+ | constraints: distance (rigid or spring with stiffness / damping), pin, pointer drag | ✅ yes | no revolute motors / joint limits |
55
+ | sensors, collision categories / masks, collision events, sleeping | ✅ yes | |
56
+ | fixed time step + accumulator (same result at any frame rate) | ✅ yes | |
57
+ | SSR / workers | ✅ yes | pure maths; world.run() needs the runtime ticker |
58
+
59
+ ## Components that need it
60
+
61
+ - `<usa-physics-playground>` — Physics playground
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motionary",
3
- "version": "10.6.0",
3
+ "version": "10.7.0",
4
4
  "description": "Motionary (formerly use-scroll-animate): dependency-free scroll animations + 94 animated Web Components — 214 scroll-reveal presets, card/click/button morphs, physics, page transitions, generative & sound-reactive backgrounds, cursor/gesture effects, themes, micro-interactions, <usa-player>, WebGL. React, Vue, Svelte, Solid, Angular or plain HTML.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1198,6 +1198,16 @@
1198
1198
  "default": "./dist/components/plugins.cjs"
1199
1199
  }
1200
1200
  },
1201
+ "./components/ai": {
1202
+ "import": {
1203
+ "types": "./dist/components/ai.d.ts",
1204
+ "default": "./dist/components/ai.js"
1205
+ },
1206
+ "require": {
1207
+ "types": "./dist/components/ai.d.cts",
1208
+ "default": "./dist/components/ai.cjs"
1209
+ }
1210
+ },
1201
1211
  "./components/lite": {
1202
1212
  "import": {
1203
1213
  "types": "./dist/components/lite.d.ts",
@@ -1358,6 +1368,26 @@
1358
1368
  "default": "./dist/runtime/vector.cjs"
1359
1369
  }
1360
1370
  },
1371
+ "./runtime/physics": {
1372
+ "import": {
1373
+ "types": "./dist/runtime/physics.d.ts",
1374
+ "default": "./dist/runtime/physics.js"
1375
+ },
1376
+ "require": {
1377
+ "types": "./dist/runtime/physics.d.cts",
1378
+ "default": "./dist/runtime/physics.cjs"
1379
+ }
1380
+ },
1381
+ "./runtime/format-scene": {
1382
+ "import": {
1383
+ "types": "./dist/runtime/format-scene.d.ts",
1384
+ "default": "./dist/runtime/format-scene.js"
1385
+ },
1386
+ "require": {
1387
+ "types": "./dist/runtime/format-scene.d.cts",
1388
+ "default": "./dist/runtime/format-scene.cjs"
1389
+ }
1390
+ },
1361
1391
  "./manifest.json": "./dist/manifest.json",
1362
1392
  "./manifest.schema.json": "./dist/manifest.schema.json",
1363
1393
  "./components.css": "./dist/components.css",