@rig-c/play 1.21.1 → 1.21.3

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 (2) hide show
  1. package/README.md +41 -117
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  <p align="center">
2
- <img src="assets/banner.svg" alt="@rig-c/play - plays rigc's compiled model as DOM elements or one canvas" width="100%" />
2
+ <img src="https://raw.githubusercontent.com/rig-c/play/main/assets/banner.svg" alt="@rig-c/play — Plays rig-c's compiled model as plain DOM elements or one canvas" width="100%" />
3
3
  </p>
4
4
 
5
5
  <p align="center">
@@ -12,8 +12,8 @@
12
12
  compiled model document `rigc build` writes, `skeleton.model.json` — as **plain
13
13
  DOM**: one absolutely-positioned `<img>` per rigid slot, posed with a single CSS
14
14
  `matrix()` write per frame, and deforming meshes on small per-part canvases; or
15
- as **one canvas** per player. It poses through `rig-c/core`, rigc's own posing
16
- core, bundled into the package, and links nothing from Esoteric Software.
15
+ as **one canvas** per player. It poses through rigc's bundled `rig-c/runtime`
16
+ and `rig-c/core`, and links nothing from Esoteric Software.
17
17
  `rig-play` is the convenience install name; `spine-html` is the legacy install name.
18
18
  The compiler is [@rig-c/core](https://github.com/rig-c/core) (npm `@rig-c/core`)
19
19
  and the part generator [rig-c/parts](https://github.com/rig-c/parts).
@@ -39,65 +39,14 @@ links to either earlier name keep working.
39
39
 
40
40
  ### Measured
41
41
 
42
- **Standing comparison against `@esotericsoftware/spine-webgl 4.3.13` (`npm run bench`, #39)** —
43
- measured on 2026-10-17 in **headed** Chromium `151.0.7922.34` on an Apple M4 GPU
44
- (`ANGLE (Apple, ANGLE Metal Renderer: Apple M4, Unspecified Version)`, macOS `Darwin 25.6.0`,
45
- 10 cores, 32 GiB RAM, `1280×720` viewport, `devicePixelRatio: 1`, 100 warm-up frames +
46
- 600 measured frames per row, `loadPerCoreBefore: 0.33`, `loadPerCoreAfter: 0.33` under the
47
- `1.0` load guard; each row is its own page load with only that runtime animating, and grid
48
- scenes batch the official skeletons through one shared WebGL canvas while `small players`
49
- mounts independent player instances):
50
-
51
- | scene | runtime | rig | clipped to | fps | pose ms | render ms | drawn players | triangles | draw calls | origin Δpx | live contexts |
52
- | --- | --- | --- | --- | --: | --: | --: | --: | --: | --: | --: | --: |
53
- | 1 meshed rig animating | dom | `portrait-packed` `turn` | pane | 59.99 | 0.17 | 0.16 | —/1 | 48 | — | 0.007 | —/1 |
54
- | 1 meshed rig animating | canvas | `portrait-packed` `turn` | pane | 59.99 | 0.23 | 0.18 | —/1 | 0 | 0 | 0.007 | —/1 |
55
- | 1 meshed rig animating | official | `portrait-packed` `turn` | pane | 60.00 | 0.05 | 0.13 | 1/1 | 88 | 1 | 0.000 | 1/1 |
56
- | 4 meshed rigs animating | dom | `portrait-packed` `turn` | pane | 60.01 | 0.46 | 0.48 | —/4 | 96 | — | 0.009 | —/1 |
57
- | 4 meshed rigs animating | canvas | `portrait-packed` `turn` | pane | 60.00 | 0.60 | 0.49 | —/4 | 176 | 2 | 0.009 | —/1 |
58
- | 4 meshed rigs animating | official | `portrait-packed` `turn` | pane | 59.99 | 0.13 | 0.17 | 4/4 | 352 | 1 | 0.000 | 1/1 |
59
- | 16 meshed rigs animating | dom | `portrait-packed` `turn` | pane | 60.00 | 0.66 | 0.74 | —/16 | 384 | — | 0.010 | —/1 |
60
- | 16 meshed rigs animating | canvas | `portrait-packed` `turn` | pane | 59.87 | 0.84 | 0.50 | —/16 | 704 | 8 | 0.010 | —/1 |
61
- | 16 meshed rigs animating | official | `portrait-packed` `turn` | pane | 60.00 | 0.21 | 0.30 | 16/16 | 1408 | 1 | 0.000 | 1/1 |
62
- | 36 meshed rigs animating | dom | `portrait-packed` `turn` | pane | 48.28 | 1.24 | 1.42 | —/36 | 1104 | — | 0.010 | —/1 |
63
- | 36 meshed rigs animating | canvas | `portrait-packed` `turn` | pane | 60.11 | 1.15 | 0.85 | —/36 | 1760 | 20 | 0.010 | —/1 |
64
- | 36 meshed rigs animating | official | `portrait-packed` `turn` | pane | 60.00 | 0.43 | 0.49 | 36/36 | 3168 | 1 | 0.000 | 1/1 |
65
- | 64 meshed rigs animating | dom | `portrait-packed` `turn` | pane | 29.07 | 2.13 | 2.69 | —/64 | 1824 | — | 0.010 | —/1 |
66
- | 64 meshed rigs animating | canvas | `portrait-packed` `turn` | pane | 53.99 | 1.62 | 1.17 | —/64 | 3168 | 36 | 0.010 | —/1 |
67
- | 64 meshed rigs animating | official | `portrait-packed` `turn` | pane | 59.99 | 0.42 | 0.54 | 64/64 | 5632 | 1 | 0.000 | 1/1 |
68
- | 1 meshed rig animating (canvas2d) | dom | `portrait-packed` `turn` | pane | 60.00 | 0.18 | 0.28 | —/1 | 48 | — | 0.007 | —/0 |
69
- | 1 meshed rig animating (canvas2d) | canvas | `portrait-packed` `turn` | pane | 60.00 | 0.20 | 0.18 | —/1 | 88 | 1 | 0.007 | —/1 |
70
- | 1 meshed rig animating (canvas2d) | official | `portrait-packed` `turn` | pane | 59.99 | 0.06 | 0.14 | 1/1 | 88 | 1 | 0.000 | 1/1 |
71
- | 16 meshed rigs animating (canvas2d) | dom | `portrait-packed` `turn` | pane | 59.89 | 0.65 | 0.99 | —/16 | 384 | — | 0.010 | —/0 |
72
- | 16 meshed rigs animating (canvas2d) | canvas | `portrait-packed` `turn` | pane | 60.00 | 0.93 | 0.59 | —/16 | 792 | 9 | 0.010 | —/1 |
73
- | 16 meshed rigs animating (canvas2d) | official | `portrait-packed` `turn` | pane | 60.00 | 0.18 | 0.31 | 16/16 | 1408 | 1 | 0.000 | 1/1 |
74
- | 1 held pose | dom | `portrait-packed` `turn` | pane | 60.11 | 0.00 | 0.15 | —/1 | 0 | — | 0.007 | —/1 |
75
- | 1 held pose | canvas | `portrait-packed` `turn` | pane | 60.02 | 0.01 | 0.11 | —/1 | 0 | 0 | 0.007 | —/1 |
76
- | 1 held pose | official | `portrait-packed` `turn` | pane | 60.00 | 0.00 | 0.13 | 1/1 | 88 | 1 | 0.000 | 1/1 |
77
- | 16 held poses | dom | `portrait-packed` `turn` | pane | 60.09 | 0.00 | 0.43 | —/16 | 0 | — | 0.010 | —/1 |
78
- | 16 held poses | canvas | `portrait-packed` `turn` | pane | 59.99 | 0.01 | 0.55 | —/16 | 0 | 0 | 0.010 | —/1 |
79
- | 16 held poses | official | `portrait-packed` `turn` | pane | 60.08 | 0.00 | 0.35 | 16/16 | 1408 | 1 | 0.000 | 1/1 |
80
- | 64 held poses | dom | `portrait-packed` `turn` | pane | 59.99 | 0.02 | 2.43 | —/64 | 0 | — | 0.010 | —/1 |
81
- | 64 held poses | canvas | `portrait-packed` `turn` | pane | 60.10 | 0.02 | 2.56 | —/64 | 0 | 0 | 0.010 | —/1 |
82
- | 64 held poses | official | `portrait-packed` `turn` | pane | 60.10 | 0.00 | 0.90 | 64/64 | 5632 | 1 | 0.000 | 1/1 |
83
- | 1 rigid rig animating | dom | `walk-packed` `walk` | pane | 59.99 | 0.30 | 0.15 | —/1 | 0 | — | 0.007 | —/1 |
84
- | 1 rigid rig animating | canvas | `walk-packed` `walk` | pane | 59.99 | 0.33 | 0.21 | —/1 | 30 | 1 | 0.007 | —/1 |
85
- | 1 rigid rig animating | official | `walk-packed` `walk` | pane | 60.00 | 0.04 | 0.16 | 1/1 | 30 | 1 | 0.000 | 1/1 |
86
- | 16 rigid rigs animating | dom | `walk-packed` `walk` | pane | 60.00 | 0.77 | 0.65 | —/16 | 0 | — | 0.010 | —/1 |
87
- | 16 rigid rigs animating | canvas | `walk-packed` `walk` | pane | 60.00 | 0.62 | 0.47 | —/16 | 480 | 16 | 0.010 | —/1 |
88
- | 16 rigid rigs animating | official | `walk-packed` `walk` | pane | 60.00 | 0.15 | 0.22 | 16/16 | 480 | 1 | 0.000 | 1/1 |
89
- | 64 rigid rigs animating | dom | `walk-packed` `walk` | pane | 59.89 | 1.58 | 1.63 | —/64 | 0 | — | 0.010 | —/1 |
90
- | 64 rigid rigs animating | canvas | `walk-packed` `walk` | pane | 42.00 | 1.50 | 1.21 | —/64 | 1920 | 64 | 0.010 | —/1 |
91
- | 64 rigid rigs animating | official | `walk-packed` `walk` | pane | 60.00 | 0.14 | 0.13 | 64/64 | 1920 | 1 | 0.000 | 1/1 |
92
- | 8 small players | dom | `walk-packed` `walk` | cell | 60.00 | 0.24 | 0.18 | —/8 | 0 | — | 0.012 | —/1 |
93
- | 8 small players | canvas | `walk-packed` `walk` | cell | 60.00 | 0.33 | 0.30 | —/8 | 240 | 8 | 0.012 | —/1 |
94
- | 8 small players | official | `walk-packed` `walk` | cell | 60.00 | 0.09 | 0.24 | 8/8 | 240 | 8 | 0.007 | 8/8 |
95
- | 20 small players | dom | `walk-packed` `walk` | cell | 60.00 | 1.03 | 0.84 | —/20 | 0 | — | 0.015 | —/1 |
96
- | 20 small players | canvas | `walk-packed` `walk` | cell | 59.99 | 0.69 | 0.54 | —/20 | 600 | 20 | 0.015 | —/1 |
97
- | 20 small players | official | `walk-packed` `walk` | cell | 60.00 | 0.13 | 0.24 | 16/20 | 480 | 16 | 0.006 | 16/20 |
98
-
99
- Where each side wins and loses on that table, the Safari mesh-backend readings
100
- and the 0.x numbers are in [docs/BENCHMARK.md](docs/BENCHMARK.md).
42
+ The [standing comparison and its conditions](https://github.com/rig-c/play/blob/main/docs/BENCHMARK.md#measured) record these tradeoffs:
43
+
44
+ | scene | observation in that comparison |
45
+ | --- | --- |
46
+ | High-count meshed grids | Batched official WebGL leads. |
47
+ | Held poses | DOM and canvas modes skip rasterization. |
48
+ | Rigid-heavy grids | DOM avoids per-player canvas blits. |
49
+ | Many independent players | DOM and canvas share a WebGL context across players. |
101
50
 
102
51
  ## Install
103
52
 
@@ -112,8 +61,7 @@ The package plays rigs built by [rigc](https://github.com/rig-c/core):
112
61
  is what the player loads, and it states everything posing and drawing need —
113
62
  the skeleton, the animations, and where every region sits on its page — so the
114
63
  `.atlas` and `skeleton.json` beside it are not fetched. Poses are computed by
115
- `rig-c/core`, rigc's own posing core, which is bundled into this package: there
116
- is nothing else to install.
64
+ the bundled `rig-c/runtime` and `rig-c/core`: there is nothing else to install.
117
65
 
118
66
  ```ts
119
67
  import { loadModel, RigPlayer } from '@rig-c/play';
@@ -180,23 +128,23 @@ package built from this tree.
180
128
 
181
129
  ## Where to read next
182
130
 
183
- - [docs/REFERENCE.md](docs/REFERENCE.md) — what the player does once it is on
131
+ - [docs/REFERENCE.md](https://github.com/rig-c/play/blob/main/docs/REFERENCE.md) — what the player does once it is on
184
132
  the page: what ships and what is measured (*Status*), then every API section
185
133
  from wind, gravity and dragging to the runtime knobs and what they cost.
186
134
  `physicsMoved(scope, motion)` supplies apparent world movement to named bone,
187
135
  subtree or constraint physics; `moved()` continues to report whole-rig motion.
188
136
  See the reference for explicit pivots, units and evaluation/history limits.
189
- - [docs/MIGRATION.md](docs/MIGRATION.md) — coming from 1.8 (meshes draw through
190
- WebGL by default since 1.9) and from `spine-html` 0.8 (the 0.8 → 1.0 table,
191
- what has no counterpart, before and after).
192
- - [docs/TESTING.md](docs/TESTING.md) — how the suite holds the picture: the two
137
+ - [docs/MIGRATION.md](https://github.com/rig-c/play/blob/main/docs/MIGRATION.md) — adding live-frame consumers, coming
138
+ from 1.8 (meshes draw through WebGL by default since 1.9) and from `spine-html`
139
+ 0.8 (the 0.8 → 1.0 table, what has no counterpart, before and after).
140
+ - [docs/TESTING.md](https://github.com/rig-c/play/blob/main/docs/TESTING.md) — how the suite holds the picture: the two
193
141
  render modes' parity, the clipping oracle, the loading harness, and the
194
142
  independent official raster oracle.
195
- - [docs/BENCHMARK.md](docs/BENCHMARK.md) — the readings behind *Measured*, and
143
+ - [docs/BENCHMARK.md](https://github.com/rig-c/play/blob/main/docs/BENCHMARK.md) — the readings behind *Measured*, and
196
144
  the bench that produces them: scenes, framing, and what a headless number is
197
145
  not evidence of.
198
- - [CHANGELOG.md](CHANGELOG.md) — what each version changed;
199
- [RELEASING.md](RELEASING.md) — how a version is cut.
146
+ - [CHANGELOG.md](https://github.com/rig-c/play/blob/main/CHANGELOG.md) — what each version changed;
147
+ [RELEASING.md](https://github.com/rig-c/play/blob/main/RELEASING.md) — how a version is cut.
200
148
 
201
149
  ## Demo (this repository)
202
150
 
@@ -224,52 +172,28 @@ deterministic captures.
224
172
 
225
173
  ## How it works
226
174
 
227
- `loadModel` reads the rig's compiled model document (`rig-c/core`'s `readModel`),
228
- and `RigPlayer` opens an animation on a live track (`openTrack`): bones,
229
- constraints, physics, deform and draw order are posed by the core — all
230
- CPU-side, renderer-agnostic — one `dt` at a time. At load time each region of
231
- the document's `pages` section is cut into its own bitmap (rotation restored),
232
- one blob URL per region — except regions that already cover their whole page,
233
- which are used as they are. Per frame, the pose becomes a `PosedFrame`: for
234
- each slot in draw order, a region's four world corners (order **BL, UL, UR,
235
- BR**) or a mesh's world vertices, page UVs and triangles, its tint, blend and
236
- clip. For a region: flip Y (the frame is Y-up), derive the affine from three
175
+ `loadModel` reads the rig's compiled model document (`rig-c/core`'s `readModel`).
176
+ With the default `poser: 'auto'`, `RigPlayer` uses `rig-c/runtime`'s
177
+ `compileRuntime` and `RuntimePose` for covered models and animations, drawing
178
+ from a borrowed `LiveFrame` exposed by `player.liveFrame()`. Features and
179
+ operations outside that path's coverage use the `rig-c/core` oracle —
180
+ `openTrack` for a single track, `openTracks` for track composition. Models with
181
+ physics constraints stay on that oracle path. `player.poser` reports `"runtime"` or
182
+ `"oracle: <reason>"`; `poser: 'oracle'` selects the oracle explicitly. Posing
183
+ stays CPU-side and renderer-agnostic, advancing one `dt` at a time.
184
+ Both renderers accept a borrowed `LiveFrame` or a detached `PosedFrame`.
185
+ `player.posedFrame()` returns a snapshot that survives later pose mutations;
186
+ a live frame is valid only until the next pose mutation. See
187
+ [Borrowing a live frame](https://github.com/rig-c/play/blob/main/docs/REFERENCE.md#borrowing-a-live-frame) for the
188
+ buffer layout, lifetime and fallback policy.
189
+ At load time each region of the document's `pages` section is cut into its own
190
+ bitmap (rotation restored), one blob URL per region — except regions that
191
+ already cover their whole page, which are used as they are. Both frame forms
192
+ describe, for each slot in draw order, a region's four world corners (order
193
+ **BL, UL, UR, BR**) or a mesh's world vertices, page UVs and triangles, its tint,
194
+ blend and clip. For a region: flip Y (the frame is Y-up), derive the affine from three
237
195
  corners, write one `matrix()` string. That's the whole rigid render path.
238
196
 
239
197
  ## License
240
198
 
241
- @rig-c/play's own code is MIT (see [LICENSE](LICENSE)). That says nothing about Spine,
242
- so here is what is true of this package and this repository, stated plainly:
243
-
244
- 1. The published package — `@rig-c/play`, and `rig-play` and `spine-html`, the same files — **links
245
- nothing from Esoteric Software**. Its one module bundles the renderer and
246
- `rig-c/core` (MIT), which poses rigc's model document; no part of the
247
- [Spine Runtimes](https://github.com/EsotericSoftware/spine-runtimes) is in it or
248
- required beside it.
249
- 2. Development tooling pins `@esotericsoftware/spine-webgl` 4.3.13 and its matching
250
- spine-core dependency for the independent oracle and comparison/benchmark.
251
- The [Spine Runtimes License Agreement](https://esotericsoftware.com/spine-runtimes-license)
252
- covers those runtimes, not this project's MIT license. They remain outside
253
- production source, the public API and the library package; package guards
254
- and the library-only pack allowlist hold that boundary.
255
- The optional load-profile harness keeps `spine-pixi-v8` 4.3.13 and PixiJS
256
- in a separate private install under `bench/oracle`.
257
- 3. `rigc build`, which this repository runs to make its fixtures, also writes Spine
258
- skeleton data (`skeleton.json` and `skeleton.atlas`) beside each model document.
259
- Development tooling reads this paired export independently. Generated fixtures
260
- remain gitignored and excluded from the library package. See [NOTICE.md](NOTICE.md).
261
- 4. A product that plays that Spine data with a Spine Runtime has integrated the Spine
262
- Runtimes, whose licence permits it **under Section 2 of the
263
- [Spine Editor License Agreement](https://esotericsoftware.com/spine-editor-license)**,
264
- or otherwise on the condition that **each user of the product obtains their own
265
- Spine Editor license** — the licence's own two routes, restated, not a term of
266
- this project.
267
-
268
- > **What a consumer does with rigc's Spine-format output is governed by Esoteric
269
- > Software's terms**, not by this package — @rig-c/play neither adds those terms nor
270
- > removes them.
271
-
272
- The optional load-profile harness fetches checksum-pinned spineboy and raptor
273
- example assets together with their upstream `license.txt`. These development
274
- fixtures are gitignored and excluded from the library package. See
275
- [NOTICE.md](NOTICE.md) for the full notice.
199
+ See [NOTICE.md](NOTICE.md) for licensing and third-party notices.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rig-c/play",
3
- "version": "1.21.1",
3
+ "version": "1.21.3",
4
4
  "description": "Plays skeleton.model.json written by rigc build as plain DOM elements — rigid slots as <img> posed by CSS matrix, deform meshes on small per-part canvases — or as one canvas.",
5
5
  "type": "module",
6
6
  "license": "MIT",