@rig-c/play 1.28.0 → 1.30.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/dist/_play-runtime.js +57 -12
- package/dist/_play-runtime.js.map +1 -1
- package/dist/composed-camera.d.ts.map +1 -1
- package/dist/composed-take.d.ts +16 -1
- package/dist/composed-take.d.ts.map +1 -1
- package/dist/composed-take.js +392 -76
- package/dist/composed-take.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/loadModel.d.ts +7 -1
- package/dist/loadModel.d.ts.map +1 -1
- package/dist/scene-camera.d.ts.map +1 -1
- package/docs/REFERENCE.md +38 -0
- package/package.json +8 -3
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { b, D, R,
|
|
1
|
+
import { b, D, R, i, d, l, n, j, k, m } from "./_play-runtime.js";
|
|
2
2
|
export {
|
|
3
3
|
b as CanvasRenderer,
|
|
4
4
|
D as DomRenderer,
|
|
5
5
|
R as RigPlayer,
|
|
6
|
-
|
|
6
|
+
i as createAtlasRegions,
|
|
7
7
|
d as discoverTurnDials,
|
|
8
8
|
l as loadModel,
|
|
9
9
|
n as normalizedDial,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
j as readSetupMesh,
|
|
11
|
+
k as revokeRegions,
|
|
12
|
+
m as unpackRegions
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
package/dist/loadModel.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ import { type AtlasRegion, type RegionImage } from './DomTexture.js';
|
|
|
11
11
|
* (`.json`, `.skel`) is refused by name: this package poses the compiled model
|
|
12
12
|
* through `rig-c/core` and reads nothing else.
|
|
13
13
|
*/
|
|
14
|
+
/**
|
|
15
|
+
* The fetch call `loadModel` makes: the call signature only. `typeof fetch`
|
|
16
|
+
* also carries whatever statics the ambient typings add (bun-types adds
|
|
17
|
+
* `preconnect`), which a wrapper or a test double cannot satisfy.
|
|
18
|
+
*/
|
|
19
|
+
export type ModelFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
14
20
|
export interface LoadModelOptions {
|
|
15
21
|
/** URL of the compiled model document (`skeleton.model.json`). */
|
|
16
22
|
modelUrl: string;
|
|
@@ -28,7 +34,7 @@ export interface LoadModelOptions {
|
|
|
28
34
|
*/
|
|
29
35
|
crossOrigin?: string;
|
|
30
36
|
/** fetch implementation, for custom headers or a test double. */
|
|
31
|
-
fetch?:
|
|
37
|
+
fetch?: ModelFetch;
|
|
32
38
|
/**
|
|
33
39
|
* What the region cut produces — the rigid tier's per-region bitmaps, which
|
|
34
40
|
* only the DOM mode draws. `'atlas'`: opt-in page-backed rigid canvases,
|
package/dist/loadModel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadModel.d.ts","sourceRoot":"","sources":["../src/loadModel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAsB,KAAK,WAAW,EAAgC,MAAM,iBAAiB,CAAC;AAEvH;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7D;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,KAAK,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"loadModel.d.ts","sourceRoot":"","sources":["../src/loadModel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,WAAW,EAAsB,KAAK,WAAW,EAAgC,MAAM,iBAAiB,CAAC;AAEvH;;;;;;;;;;;GAWG;AAEH;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CA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AAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,GAAG,SAAS,CAErF;AAqQD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CA6C/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene-camera.d.ts","sourceRoot":"","sources":["../src/scene-camera.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"scene-camera.d.ts","sourceRoot":"","sources":["../src/scene-camera.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAG1D,MAAM,MAAM,gBAAgB,GACxB;IAAE,KAAK,EAAE,UAAU,GAAG,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GACvE;IAAE,QAAQ,EAAE,UAAU,CAAA;CAAE,CAAC;AAE7B,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,qDAAqD;IACrD,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC7C,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,GAAG,IAAI,CAAC;CAC7E;AAED,MAAM,MAAM,kBAAkB,GAAG,6BAA6B,GAAG,6BAA6B,GAC1F,4BAA4B,GAAG,4BAA4B,GAAG,2BAA2B,GACzF,+BAA+B,CAAC;AAQpC,eAAO,MAAM,6BAA6B,QAAkB,CAAC"}
|
package/docs/REFERENCE.md
CHANGED
|
@@ -545,6 +545,41 @@ a skeletal clip shared by planes with different shifts uses a polygon moved
|
|
|
545
545
|
with each distinct shift. Omitting the report, supplying report /1, or
|
|
546
546
|
selecting an unkeyed /2 take uses the existing fixed-stage path.
|
|
547
547
|
|
|
548
|
+
On a looping, digest-bound keyed take, a Parts `scene_driven` declaration
|
|
549
|
+
can give the view and the listed numeric bone timelines their own phase.
|
|
550
|
+
Parallax enables this by default. Set `hoverHold: true` to enable it in Fixed
|
|
551
|
+
with zero pointer displacement. The pointer eases their playback rate to zero over
|
|
552
|
+
`transitionMs`, holds the continuous phase reached at the end of that
|
|
553
|
+
transition, then eases back to full rate from that phase on leave. Life
|
|
554
|
+
timelines, events and physics keep their existing clocks. Pointer turn
|
|
555
|
+
in Parallax continues to blend each bound axis toward the pointer. A scene-keyed dial
|
|
556
|
+
blends back toward its scene sample, and a character-keyed dial toward its
|
|
557
|
+
live sample. Set `pointerTurn: false` to keep each dial on its authored phase.
|
|
558
|
+
Touch leaves the scene clock automatic.
|
|
559
|
+
|
|
560
|
+
| Operation | Scene phase |
|
|
561
|
+
| --- | --- |
|
|
562
|
+
| `player.pause()` and `player.resume()` | The scene phase and player track time freeze in place and resume with the same offset. |
|
|
563
|
+
| `player.seek()`, replay, or a take change | Both phases start from the resulting player track time. With the pointer inside, the scene holds immediately at that phase. |
|
|
564
|
+
| Camera mode change | A mode with scene hold starts its scene phase from the current player track time. With the pointer inside, it holds immediately. A mode without scene hold follows the live pose and view. |
|
|
565
|
+
|
|
566
|
+
`sceneHandoff` on the mount reports `behavior: 'hold'` with the unwrapped
|
|
567
|
+
compiled `phase`, or `'additive'` with a null phase. If the scene hold
|
|
568
|
+
binding is refused during playback it reports `'refused'`, a null phase, and a
|
|
569
|
+
`reason` naming the address or backdrop dependency when applicable. Refusals
|
|
570
|
+
retain the existing camera behavior. The hold accepts numeric bone properties
|
|
571
|
+
only, and the backdrop must depend on the scene phase alone. One-shots,
|
|
572
|
+
pose-only declarations and report /1 do not enable this mode. Reports and
|
|
573
|
+
takes without the declaration keep their existing behavior. Attachment-set
|
|
574
|
+
operations that change the backdrop slot are outside the scene hold's
|
|
575
|
+
coverage contract.
|
|
576
|
+
|
|
577
|
+
The hold uses the same sampled-row geometric guard as automatic playback.
|
|
578
|
+
A held phase can dwell between two rows where the margin is smaller. On the
|
|
579
|
+
public eased fixture at 1.1333 seconds, the margin after the admitted excursion
|
|
580
|
+
is 0.441 backing pixels against the one-pixel guard. The view still lies
|
|
581
|
+
inside the backdrop at that phase.
|
|
582
|
+
|
|
548
583
|
To drive rendering directly, import `bindSceneCamera`,
|
|
549
584
|
`sceneCameraProjection` and `renderSceneCameraFrame` from
|
|
550
585
|
`@rig-c/play/composed-take`. Pass `bindSceneCamera(report, model)` the stage,
|
|
@@ -588,6 +623,7 @@ pixels.
|
|
|
588
623
|
| `transitionMs` | 120 ms in each direction. |
|
|
589
624
|
| `autoSweep` | Omitted. Automatic sweep is opt-in. The demo's **Automatic and pointer** setting uses a 12-second period and `{ x: 24, y: 0 }` CSS px before gains. |
|
|
590
625
|
| `pointerTurn` | Enabled. Set `false` for camera-only control. |
|
|
626
|
+
| `hoverHold` | Enabled in Parallax, disabled in Fixed and Pan. Set `false` to disable Parallax hold. Set `true` in Fixed to require a valid scene hold binding. Pan refuses `true`. |
|
|
591
627
|
|
|
592
628
|
Use `take.setCamera()` with `'fixed'`, `'pan'` or `'parallax'`. Fixed plays
|
|
593
629
|
the authored pose with the camera at rest. Pan uses gain 1 on each plane.
|
|
@@ -653,6 +689,8 @@ successful `setCamera()` clears that status.
|
|
|
653
689
|
| `COMPOSED_BACKDROP_COVERAGE` | Invalid plate geometry, inadequate stage coverage or unavailable opacity readback on the fixed-stage path, or insufficient sampled margin for extra displacement on a keyed take |
|
|
654
690
|
| `COMPOSED_INVALID_DISPLACEMENT` | Invalid excursion, sweep period, transition duration or gain |
|
|
655
691
|
| `COMPOSED_INVALID_CAMERA` | Unrecognized mode |
|
|
692
|
+
| `COMPOSED_HOVER_HOLD_UNSUPPORTED_MODE` | `hoverHold: true` with Pan |
|
|
693
|
+
| `COMPOSED_HOVER_HOLD_UNAVAILABLE` | Selecting Fixed with `hoverHold: true` and a missing or refused scene hold binding |
|
|
656
694
|
| `COMPOSED_PLATE_TRACK` | Unsupported plate track or gain binding, or a sweep combined with baked travel |
|
|
657
695
|
| `SCENE_CAMERA_REPORT_INVALID` | Missing, unreadable or malformed declared scene report or camera data |
|
|
658
696
|
| `SCENE_CAMERA_REPORT_TOO_LARGE` | Raw UTF-8 report exceeds the consumer byte budget |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rig-c/play",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
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",
|
|
@@ -89,6 +89,9 @@
|
|
|
89
89
|
"prebuild": "bash scripts/fetch-assets.sh",
|
|
90
90
|
"build": "tsc --noEmit && vite build",
|
|
91
91
|
"build:lib": "rm -rf dist && node scripts/build-lib.mjs dist",
|
|
92
|
+
"hooks": "([ -e .git ] && [ -f .githooks/pre-commit ] && [ \"$(git config --get core.hooksPath 2>/dev/null)\" != .githooks ] && git rev-parse --git-dir >/dev/null 2>&1 && git config core.hooksPath .githooks >/dev/null 2>&1 || true)",
|
|
93
|
+
"typecheck": "bun run hooks && tsc --noEmit",
|
|
94
|
+
"lint": "bun run hooks && eslint .",
|
|
92
95
|
"prepublishOnly": "node -e \"console.error('Publish the release tarball produced by scripts/pack-release.mjs. See RELEASING.md.'); process.exit(1)\"",
|
|
93
96
|
"preview": "vite preview",
|
|
94
97
|
"test": "playwright test",
|
|
@@ -100,10 +103,12 @@
|
|
|
100
103
|
"devDependencies": {
|
|
101
104
|
"@esotericsoftware/spine-webgl": "4.3.13",
|
|
102
105
|
"@playwright/test": "1.62.1",
|
|
103
|
-
"@rig-c/core": "3.
|
|
104
|
-
"@rig-c/parts": "2.
|
|
106
|
+
"@rig-c/core": "3.12.0",
|
|
107
|
+
"@rig-c/parts": "2.70.0",
|
|
105
108
|
"@types/node": "^22",
|
|
109
|
+
"eslint": "10.16.0",
|
|
106
110
|
"typescript": "^5.6.0",
|
|
111
|
+
"typescript-eslint": "8.74.0",
|
|
107
112
|
"vite": "^6.0.0"
|
|
108
113
|
}
|
|
109
114
|
}
|