@3driseai/3drise-viewer 0.1.45 → 0.1.46
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/animationsV2/ClipPlayer.d.ts.map +1 -1
- package/dist/animationsV2/ClipPlayer.js +22 -2
- package/dist/animationsV2/ClipsRuntime.d.ts +7 -1
- package/dist/animationsV2/ClipsRuntime.d.ts.map +1 -1
- package/dist/animationsV2/ClipsRuntime.js +49 -4
- package/dist/animationsV2/appliers.d.ts.map +1 -1
- package/dist/animationsV2/appliers.js +11 -0
- package/dist/animationsV2/index.d.ts +2 -0
- package/dist/animationsV2/index.d.ts.map +1 -1
- package/dist/animationsV2/index.js +1 -0
- package/dist/animationsV2/uiTracks.d.ts +35 -0
- package/dist/animationsV2/uiTracks.d.ts.map +1 -0
- package/dist/animationsV2/uiTracks.js +152 -0
- package/dist/api/sceneHandle.d.ts +1 -1
- package/dist/api/sceneHandle.d.ts.map +1 -1
- package/dist/api/sceneHandle.js +10 -9
- package/dist/ui/uiBaseStyles.d.ts.map +1 -1
- package/dist/ui/uiBaseStyles.js +10 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClipPlayer.d.ts","sourceRoot":"","sources":["../../src/animationsV2/ClipPlayer.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC5B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC;IACpC,wDAAwD;IACxD,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;IACvD,6FAA6F;IAC7F,QAAQ,CAAC,EAAE;QAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;QAAC,KAAK,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;CACzE;
|
|
1
|
+
{"version":3,"file":"ClipPlayer.d.ts","sourceRoot":"","sources":["../../src/animationsV2/ClipPlayer.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAKjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC5B,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC;IACpC,wDAAwD;IACxD,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;IACvD,6FAA6F;IAC7F,QAAQ,CAAC,EAAE;QAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;QAAC,KAAK,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC;CACzE;AA2BD,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA+JzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -29,6 +29,20 @@ import { clipMap } from './sequenceUtils.js';
|
|
|
29
29
|
import { sceneReadiness } from '../triggers/readiness.js';
|
|
30
30
|
/** Wheel delta in pixels, whatever the device reports. */
|
|
31
31
|
const wheelPixels = (e) => e.deltaMode === 1 ? e.deltaY * 16 : e.deltaMode === 2 ? e.deltaY * window.innerHeight : e.deltaY;
|
|
32
|
+
/** The runtime reset on unmount, deferred one tick so an immediate remount can cancel it (see below). */
|
|
33
|
+
let pendingReset = 0;
|
|
34
|
+
const scheduleReset = () => {
|
|
35
|
+
if (pendingReset)
|
|
36
|
+
return;
|
|
37
|
+
pendingReset = window.setTimeout(() => { pendingReset = 0; ClipsRuntime.reset(); }, 0);
|
|
38
|
+
};
|
|
39
|
+
const cancelPendingReset = () => {
|
|
40
|
+
if (!pendingReset)
|
|
41
|
+
return;
|
|
42
|
+
window.clearTimeout(pendingReset);
|
|
43
|
+
pendingReset = 0;
|
|
44
|
+
ClipsRuntime.dlog('reset cancelled (remounted at once)');
|
|
45
|
+
};
|
|
32
46
|
/** Diagnostics switch: `?animdebug=1` or localStorage '3drise.animdebug' = '1'. */
|
|
33
47
|
function animDebugOn() {
|
|
34
48
|
try {
|
|
@@ -91,8 +105,14 @@ const ClipPlayer = ({ getSettings, getAction, autoplay }) => {
|
|
|
91
105
|
});
|
|
92
106
|
}, [autoplay?.sequences, autoplay?.clips]);
|
|
93
107
|
const isPublished = !!autoplay;
|
|
94
|
-
|
|
95
|
-
|
|
108
|
+
// Leaving the scene clears the runtime - but not on a mount → unmount → mount in one go (React's
|
|
109
|
+
// dev StrictMode, a re-suspend): that reset would wipe a story an outside page had just started.
|
|
110
|
+
// The reset is deferred a tick and cancelled by the next mount.
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
cancelPendingReset();
|
|
113
|
+
return () => { if (isPublished)
|
|
114
|
+
scheduleReset(); };
|
|
115
|
+
}, [isPublished]);
|
|
96
116
|
// --- input drivers ----------------------------------------------------------------
|
|
97
117
|
useEffect(() => {
|
|
98
118
|
const canvas = gl.domElement;
|
|
@@ -95,11 +95,15 @@ declare class ClipsRuntime {
|
|
|
95
95
|
* applier for the path or its target is not mounted.
|
|
96
96
|
*/
|
|
97
97
|
setLiveValue(state: string, path: string, value: KeyValue, node?: string): boolean;
|
|
98
|
+
/** Per property: a scrubbed sequence's last sample while a control's value stands in for it (see setLiveValue). */
|
|
99
|
+
private yielded;
|
|
98
100
|
/** What was last written by `setLiveValue`, else the authored value (action patches included). */
|
|
99
101
|
getLiveValue(state: string, path: string, node?: string): KeyValue | undefined;
|
|
100
102
|
/** Diagnostics: a write whose speed differs sharply from the previous frame's (a velocity discontinuity), per property. */
|
|
101
103
|
private lastSpeed;
|
|
102
104
|
private probeJump;
|
|
105
|
+
/** Public read of `currentValue`: what the scene shows now, a clip's writes included (SceneHandle.values.get). */
|
|
106
|
+
getCurrentValue(state: string, path: string, node?: string): KeyValue | undefined;
|
|
103
107
|
/** Where a property is right now: the live scene where it can be read, else the last value the runtime wrote, else the live / authored value. */
|
|
104
108
|
private currentValue;
|
|
105
109
|
/** Whether `setLiveValue` can write this path (it has an applier). */
|
|
@@ -170,7 +174,9 @@ declare class ClipsRuntime {
|
|
|
170
174
|
* Set a sequence's position, 0–1 along its own direction (reverse flips it). A
|
|
171
175
|
* driven sequence eases there (its smoothing); any other is posed there at once.
|
|
172
176
|
*/
|
|
173
|
-
setSequenceProgress(seqId: string, progress: number
|
|
177
|
+
setSequenceProgress(seqId: string, progress: number, opts?: {
|
|
178
|
+
external?: boolean;
|
|
179
|
+
}): boolean;
|
|
174
180
|
/**
|
|
175
181
|
* Move a driven sequence's target by `delta` of its length (the wheel). Returns
|
|
176
182
|
* false when it is already at that end — the caller then lets the event through
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClipsRuntime.d.ts","sourceRoot":"","sources":["../../src/animationsV2/ClipsRuntime.ts"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1E,OAAO,EAA8F,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAE3I,OAAO,EAEL,KAAK,UAAU,EAAE,KAAK,aAAa,EAEpC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"ClipsRuntime.d.ts","sourceRoot":"","sources":["../../src/animationsV2/ClipsRuntime.ts"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc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W;IAuCnB,0EAA0E;IAC1E,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,WAAW;IAyBnB,OAAO,CAAC,UAAU;IAOlB;;;OAGG;IACH,OAAO,CAAC,eAAe;IAwCvB,OAAO,CAAC,cAAc;IAQtB,gFAAgF;IAChF,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,cAAc;IAatB,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,IAAI;IAKZ,0DAA0D;IAC1D,OAAO,CAAC,SAAS;CAKlB;AAiBD,YAAY,EAAE,aAAa,EAAE,CAAC;AAE9B,QAAA,MAAM,YAAY,cAAqB,CAAC;AACxC,eAAe,YAAY,CAAC"}
|
|
@@ -175,6 +175,7 @@ class ClipsRuntime {
|
|
|
175
175
|
this.ctx = ctx;
|
|
176
176
|
this.written.clear();
|
|
177
177
|
this.writer.clear();
|
|
178
|
+
this.yielded.clear();
|
|
178
179
|
this.live.clear();
|
|
179
180
|
clearApplierCaches();
|
|
180
181
|
}
|
|
@@ -193,9 +194,21 @@ class ClipsRuntime {
|
|
|
193
194
|
return false;
|
|
194
195
|
const key = targetKey(state, node, path);
|
|
195
196
|
this.live.set(key, value);
|
|
196
|
-
|
|
197
|
+
// Under a scrubbed sequence (an external input such as a page's scroll), the control wins
|
|
198
|
+
// until the scrub moves this property: its last sample is kept, and the sequence writes
|
|
199
|
+
// again only when that sample changes (then it blends in from the control's value).
|
|
200
|
+
const writer = this.writer.get(key);
|
|
201
|
+
const held = writer?.startsWith('sequence:') ? this.sequences.get(writer.slice('sequence:'.length)) : undefined;
|
|
202
|
+
const last = this.written.get(key);
|
|
203
|
+
if (held?.external && last !== undefined) {
|
|
204
|
+
this.yielded.set(key, last);
|
|
205
|
+
return true;
|
|
206
|
+
}
|
|
207
|
+
this.written.delete(key); // a playing clip holding the same value must write it again
|
|
197
208
|
return true;
|
|
198
209
|
}
|
|
210
|
+
/** Per property: a scrubbed sequence's last sample while a control's value stands in for it (see setLiveValue). */
|
|
211
|
+
yielded = new Map();
|
|
199
212
|
/** What was last written by `setLiveValue`, else the authored value (action patches included). */
|
|
200
213
|
getLiveValue(state, path, node) {
|
|
201
214
|
const key = targetKey(state, node, path);
|
|
@@ -233,6 +246,8 @@ class ClipsRuntime {
|
|
|
233
246
|
if (ratio > 2.5 || ratio < 0.4)
|
|
234
247
|
this.dlog('JUMP', key, { from: prev, to: value, speedWas: +last.toFixed(4), speedNow: +speed.toFixed(4), dt: +dt.toFixed(4), at: this.clock.toFixed(3) });
|
|
235
248
|
}
|
|
249
|
+
/** Public read of `currentValue`: what the scene shows now, a clip's writes included (SceneHandle.values.get). */
|
|
250
|
+
getCurrentValue(state, path, node) { return this.currentValue(state, path, node); }
|
|
236
251
|
/** Where a property is right now: the live scene where it can be read, else the last value the runtime wrote, else the live / authored value. */
|
|
237
252
|
currentValue(state, path, node) {
|
|
238
253
|
// The live scene first: what the runtime last wrote goes stale as soon as something else
|
|
@@ -243,6 +258,11 @@ class ClipsRuntime {
|
|
|
243
258
|
return seen;
|
|
244
259
|
}
|
|
245
260
|
const key = targetKey(state, node, path);
|
|
261
|
+
if (this.yielded.has(key)) {
|
|
262
|
+
const v = this.live.get(key);
|
|
263
|
+
if (v !== undefined)
|
|
264
|
+
return v;
|
|
265
|
+
} // a control's value stands in
|
|
246
266
|
const out = this.blendOuts.get(key);
|
|
247
267
|
if (out) {
|
|
248
268
|
const u = out.duration > 0 ? (this.clock - out.start) / out.duration : 1;
|
|
@@ -331,6 +351,7 @@ class ClipsRuntime {
|
|
|
331
351
|
this.blendOf.clear();
|
|
332
352
|
this.written.clear();
|
|
333
353
|
this.writer.clear();
|
|
354
|
+
this.yielded.clear();
|
|
334
355
|
this.laid.clear();
|
|
335
356
|
this.rewrite.clear();
|
|
336
357
|
this.clashed.clear();
|
|
@@ -491,7 +512,7 @@ class ClipsRuntime {
|
|
|
491
512
|
getDrivenSequences() {
|
|
492
513
|
const out = [];
|
|
493
514
|
for (const inst of this.sequences.values()) {
|
|
494
|
-
if (!inst.driven || !inst.playing)
|
|
515
|
+
if (!inst.driven || !inst.playing || inst.external)
|
|
495
516
|
continue;
|
|
496
517
|
out.push({ id: inst.seq.id, driver: inst.seq.driver, settings: inst.seq.driverSettings, progress: this.progressOf(inst, inst.target) });
|
|
497
518
|
}
|
|
@@ -501,10 +522,14 @@ class ClipsRuntime {
|
|
|
501
522
|
* Set a sequence's position, 0–1 along its own direction (reverse flips it). A
|
|
502
523
|
* driven sequence eases there (its smoothing); any other is posed there at once.
|
|
503
524
|
*/
|
|
504
|
-
setSequenceProgress(seqId, progress) {
|
|
525
|
+
setSequenceProgress(seqId, progress, opts = {}) {
|
|
505
526
|
const inst = this.sequences.get(seqId);
|
|
506
527
|
if (!inst)
|
|
507
528
|
return false;
|
|
529
|
+
if (opts.external && !inst.external) {
|
|
530
|
+
inst.external = true;
|
|
531
|
+
this.dlog('external input takes', inst.seq.name, '(the built-in wheel / touch / pointer stand down)');
|
|
532
|
+
}
|
|
508
533
|
const T = this.timeOf(inst, progress);
|
|
509
534
|
inst.target = T;
|
|
510
535
|
if (!inst.driven)
|
|
@@ -790,7 +815,26 @@ class ClipsRuntime {
|
|
|
790
815
|
else
|
|
791
816
|
value = mixValues(p.path, blend.from, p.value, smooth(u));
|
|
792
817
|
}
|
|
793
|
-
|
|
818
|
+
let json = JSON.stringify(value);
|
|
819
|
+
// A control's value stands in for this scrubbed sequence until its sample moves; then the
|
|
820
|
+
// sequence takes over again, blending in from the control's value.
|
|
821
|
+
const yielded = this.yielded.get(key);
|
|
822
|
+
if (yielded !== undefined) {
|
|
823
|
+
if (yielded === JSON.stringify(p.value) && !this.forceWrite) {
|
|
824
|
+
this.writer.set(key, p.driver);
|
|
825
|
+
continue;
|
|
826
|
+
}
|
|
827
|
+
this.yielded.delete(key);
|
|
828
|
+
const duration = p.blend ?? DEFAULT_BLEND;
|
|
829
|
+
const from = this.live.get(key);
|
|
830
|
+
if (duration > 0 && from !== undefined && JSON.stringify(from) !== JSON.stringify(p.value)) {
|
|
831
|
+
blend = { from, start: this.clock, duration };
|
|
832
|
+
this.blends.set(key, blend);
|
|
833
|
+
value = from;
|
|
834
|
+
json = JSON.stringify(value);
|
|
835
|
+
this.dlog('blend in (after a control)', key, { from, to: p.value, duration });
|
|
836
|
+
}
|
|
837
|
+
}
|
|
794
838
|
// Unchanged: nothing to write — but the property is this driver's now (else every frame
|
|
795
839
|
// would look like a take-over, restart the blend and pin the property where it was).
|
|
796
840
|
if (!this.forceWrite && this.written.get(key) === json && !this.rewrite.has(p.state)) {
|
|
@@ -1079,6 +1123,7 @@ class ClipsRuntime {
|
|
|
1079
1123
|
this.written.delete(key);
|
|
1080
1124
|
this.writer.delete(key);
|
|
1081
1125
|
this.blends.delete(key);
|
|
1126
|
+
this.yielded.delete(key);
|
|
1082
1127
|
if (track.node) {
|
|
1083
1128
|
// Node tracks restore their exact pre-animation snapshot (see nodeTracks).
|
|
1084
1129
|
const node = track.node;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appliers.d.ts","sourceRoot":"","sources":["../../src/animationsV2/appliers.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAgB/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"appliers.d.ts","sourceRoot":"","sources":["../../src/animationsV2/appliers.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAgB/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAOxC,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAKrE;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,qDAAqD;IACrD,QAAQ,EAAE,GAAG,CAAC;IACd,yFAAyF;IACzF,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC;IACpC,0EAA0E;IAC1E,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;CACxD;AAWD,wBAAgB,kBAAkB,IAAI,IAAI,CAKzC;AA0OD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAOhE;AAED,uFAAuF;AACvF,mFAAmF;AACnF,wBAAgB,UAAU,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAIlH;AAED,mFAAmF;AACnF,wBAAgB,eAAe,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAMxF;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjE;AAMD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAkClH"}
|
|
@@ -11,6 +11,7 @@ import { applyNodeValue, clearNodeCaches, nodesFor, readNodeValue } from './node
|
|
|
11
11
|
import { setObjectEffectParam } from '../operations/objectEffects.js';
|
|
12
12
|
import { setAnimationLive, transformAnimationIndex } from './animationLive.js';
|
|
13
13
|
import { applyRenderValue, RENDER_LIVE_PATHS } from '../render/renderLive.js';
|
|
14
|
+
import { applyUiValue, clearUiTrackCaches, isUiTargetMounted, isUiTrackPath, readUiValue, releaseUiValue, uiLayerOf } from './uiTracks.js';
|
|
14
15
|
/** `effects.<effectId>.<param>` → [effectId, param] (null for any other path). */
|
|
15
16
|
export function effectParamPath(path) {
|
|
16
17
|
if (!path.startsWith('effects.'))
|
|
@@ -26,6 +27,7 @@ export function clearApplierCaches() {
|
|
|
26
27
|
objectCache.clear();
|
|
27
28
|
handleCache.clear();
|
|
28
29
|
clearNodeCaches();
|
|
30
|
+
clearUiTrackCaches();
|
|
29
31
|
}
|
|
30
32
|
function objectFor(state) {
|
|
31
33
|
const cached = objectCache.get(state);
|
|
@@ -259,8 +261,11 @@ const applyTime = (_ctx, _state, path, value) => {
|
|
|
259
261
|
};
|
|
260
262
|
/** Post-processing / exposure / HDR (renderLive). False when the effect is not mounted. */
|
|
261
263
|
const applyRender = (_ctx, _state, path, value) => applyRenderValue(path, value);
|
|
264
|
+
/** An element of a UI layer (`ui:<layerKey>` / `<elementId>.<prop>`, see uiTracks). */
|
|
265
|
+
const applyUi = (_ctx, state, path, value) => applyUiValue(state, path, value);
|
|
262
266
|
const APPLIERS = [
|
|
263
267
|
{ match: (s) => s === 'camera', apply: applyCamera },
|
|
268
|
+
{ match: isUiTrackPath, apply: applyUi },
|
|
264
269
|
{ match: (s, p) => s === 'render' && RENDER_LIVE_PATHS.includes(p), apply: applyRender },
|
|
265
270
|
{ match: (s, p) => s === 'time' && TIME_PATHS.includes(p), apply: applyTime },
|
|
266
271
|
// Environment before the generic path families: the ocean's `config.*` is not an object's.
|
|
@@ -281,6 +286,8 @@ const APPLIERS = [
|
|
|
281
286
|
* other path (those restore from the authored settings).
|
|
282
287
|
*/
|
|
283
288
|
export function releaseLive(state, path) {
|
|
289
|
+
if (uiLayerOf(state) !== null)
|
|
290
|
+
return releaseUiValue(state, path);
|
|
284
291
|
const at = effectParamPath(path);
|
|
285
292
|
if (at) {
|
|
286
293
|
setObjectEffectParam(objectFor(state), at[0], at[1], undefined);
|
|
@@ -305,6 +312,8 @@ export function applyValue(ctx, state, path, value, node) {
|
|
|
305
312
|
export function isTargetMounted(ctx, state, node) {
|
|
306
313
|
if (state === 'camera')
|
|
307
314
|
return !!ctx.camera;
|
|
315
|
+
if (uiLayerOf(state) !== null)
|
|
316
|
+
return isUiTargetMounted(state);
|
|
308
317
|
if (state === 'sky' || state === 'clouds' || state === 'ocean' || state === 'terrain' || state === 'time' || state === 'render')
|
|
309
318
|
return true;
|
|
310
319
|
if (node)
|
|
@@ -328,6 +337,8 @@ const vec3 = (v) => [v.x, v.y, v.z];
|
|
|
328
337
|
export function readSceneValue(ctx, state, path, node) {
|
|
329
338
|
if (node)
|
|
330
339
|
return readNodeValue(state, node, path);
|
|
340
|
+
if (uiLayerOf(state) !== null)
|
|
341
|
+
return readUiValue(state, path);
|
|
331
342
|
if (state === 'camera') {
|
|
332
343
|
const cam = ctx.camera;
|
|
333
344
|
if (!cam)
|
|
@@ -7,6 +7,8 @@ export * from './sequenceUtils';
|
|
|
7
7
|
export * from './normalize';
|
|
8
8
|
export { applyValue, clearApplierCaches } from './appliers';
|
|
9
9
|
export type { ApplyContext } from './appliers';
|
|
10
|
+
export { UI_PROPS, UI_STATE_PREFIX, uiLayerOf, uiPathOf, uiAnimatableElements, isUiTrackPath } from './uiTracks';
|
|
11
|
+
export type { UiPropSpec } from './uiTracks';
|
|
10
12
|
export { readNodeValue, NODE_TRANSFORM_PATHS, NODE_MATERIAL_KEYS } from './nodeTracks';
|
|
11
13
|
export { resolveElementSettings, isEnvironmentState, ENVIRONMENT_STATES as CLIP_ENVIRONMENT_STATES } from './elementSettings';
|
|
12
14
|
export type { ElementSources } from './elementSettings';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/animationsV2/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,YAAY,EA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6,6 +6,7 @@ export * from './clipUtils.js';
|
|
|
6
6
|
export * from './sequenceUtils.js';
|
|
7
7
|
export * from './normalize.js';
|
|
8
8
|
export { applyValue, clearApplierCaches } from './appliers.js';
|
|
9
|
+
export { UI_PROPS, UI_STATE_PREFIX, uiLayerOf, uiPathOf, uiAnimatableElements, isUiTrackPath } from './uiTracks.js';
|
|
9
10
|
export { readNodeValue, NODE_TRANSFORM_PATHS, NODE_MATERIAL_KEYS } from './nodeTracks.js';
|
|
10
11
|
export { resolveElementSettings, isEnvironmentState, ENVIRONMENT_STATES as CLIP_ENVIRONMENT_STATES } from './elementSettings.js';
|
|
11
12
|
export { DEFAULT_DRIVER_SETTINGS } from './types.js';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { KeyValue } from './types';
|
|
2
|
+
export declare const UI_STATE_PREFIX = "ui:";
|
|
3
|
+
export interface UiPropSpec {
|
|
4
|
+
path: string;
|
|
5
|
+
label: string;
|
|
6
|
+
type: 'number' | 'boolean';
|
|
7
|
+
min?: number;
|
|
8
|
+
max?: number;
|
|
9
|
+
step?: number;
|
|
10
|
+
default: KeyValue;
|
|
11
|
+
unit?: string;
|
|
12
|
+
}
|
|
13
|
+
/** The animatable properties of a UI element, in picker order. `path` is the part after the element id. */
|
|
14
|
+
export declare const UI_PROPS: readonly UiPropSpec[];
|
|
15
|
+
/** `ui:<layerKey>` → layerKey, else null. */
|
|
16
|
+
export declare function uiLayerOf(state: string): string | null;
|
|
17
|
+
/** `<elementId>.<prop>` → [elementId, prop spec], else null (unknown prop or no id). */
|
|
18
|
+
export declare function uiPathOf(path: string): [string, UiPropSpec] | null;
|
|
19
|
+
export declare const isUiTrackPath: (state: string, path: string) => boolean;
|
|
20
|
+
export declare function clearUiTrackCaches(): void;
|
|
21
|
+
/** Whether a layer is rendered and has the element (undefined id = the layer alone). */
|
|
22
|
+
export declare function isUiTargetMounted(state: string, path?: string): boolean;
|
|
23
|
+
/** Write one sampled value. False when the layer or element is not rendered. */
|
|
24
|
+
export declare function applyUiValue(state: string, path: string, value: KeyValue): boolean;
|
|
25
|
+
/** The track's value as the element shows it now (its var, else the prop's natural value). */
|
|
26
|
+
export declare function readUiValue(state: string, path: string): KeyValue | undefined;
|
|
27
|
+
/** The track stops: its var comes off; with none left, so does the mark. `visible` returns to the layer's own (shown). */
|
|
28
|
+
export declare function releaseUiValue(state: string, path: string): boolean;
|
|
29
|
+
/** Elements of a rendered layer that can be animated (those with an id), for pickers. */
|
|
30
|
+
export declare function uiAnimatableElements(layerKey: string): Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
tag: string;
|
|
33
|
+
text: string;
|
|
34
|
+
}>;
|
|
35
|
+
//# sourceMappingURL=uiTracks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uiTracks.d.ts","sourceRoot":"","sources":["../../src/animationsV2/uiTracks.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,QAAQ,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,2GAA2G;AAC3G,eAAO,MAAM,QAAQ,EAAE,SAAS,UAAU,EASzC,CAAC;AAIF,6CAA6C;AAC7C,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEtD;AAED,wFAAwF;AACxF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,IAAI,CAOlE;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,EAAE,MAAM,MAAM,KAAG,OAA+D,CAAC;AAM5H,wBAAgB,kBAAkB,IAAI,IAAI,CAA0B;AAcpE,wFAAwF;AACxF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAMvE;AAMD,gFAAgF;AAChF,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,OAAO,CAiBlF;AAED,8FAA8F;AAC9F,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAW7E;AAED,0HAA0H;AAC1H,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAWnE;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CASvG"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// UI tracks — the timeline animating elements of a UI layer.
|
|
3
|
+
// =============================================================================
|
|
4
|
+
//
|
|
5
|
+
// Target: state `ui:<layerKey>` (a layer, by its key)
|
|
6
|
+
// Path: `<elementId>.<prop>` (an element of that layer, by its CSS id)
|
|
7
|
+
// Props: opacity (0..1), x / y (px), xv / yv (% of the layer's width / height — the
|
|
8
|
+
// viewport, so a card can cross the whole screen on any screen), scale
|
|
9
|
+
// (1 = natural), rotate (deg) — eased; visible (true/false) — stepped.
|
|
10
|
+
//
|
|
11
|
+
// The applier writes CSS custom properties on the element (`--rise-x`, `--rise-y`,
|
|
12
|
+
// `--rise-scale`, `--rise-rotate`, `--rise-opacity`) and marks it `data-rise-anim`;
|
|
13
|
+
// the base stylesheet turns those into the individual transform properties
|
|
14
|
+
// (`translate` / `scale` / `rotate`) and `opacity`, so they compose with whatever
|
|
15
|
+
// `transform` the layer's own CSS or a `data-anchor` sets. `visible` toggles the
|
|
16
|
+
// `hidden` attribute. When the track releases, the vars and the mark come off and the
|
|
17
|
+
// element's own styling returns — same as any live-only track (see releaseLive).
|
|
18
|
+
//
|
|
19
|
+
import { getUiLayerRuntime } from '../ui/UiLayers.js';
|
|
20
|
+
export const UI_STATE_PREFIX = 'ui:';
|
|
21
|
+
/** The animatable properties of a UI element, in picker order. `path` is the part after the element id. */
|
|
22
|
+
export const UI_PROPS = [
|
|
23
|
+
{ path: 'opacity', label: 'Opacity', type: 'number', min: 0, max: 1, step: 0.01, default: 1 },
|
|
24
|
+
{ path: 'x', label: 'X offset', type: 'number', step: 1, default: 0, unit: 'px' },
|
|
25
|
+
{ path: 'y', label: 'Y offset', type: 'number', step: 1, default: 0, unit: 'px' },
|
|
26
|
+
{ path: 'xv', label: 'X offset (% of width)', type: 'number', step: 1, default: 0, unit: '%' },
|
|
27
|
+
{ path: 'yv', label: 'Y offset (% of height)', type: 'number', step: 1, default: 0, unit: '%' },
|
|
28
|
+
{ path: 'scale', label: 'Scale', type: 'number', min: 0, step: 0.01, default: 1 },
|
|
29
|
+
{ path: 'rotate', label: 'Rotate', type: 'number', step: 1, default: 0, unit: 'deg' },
|
|
30
|
+
{ path: 'visible', label: 'Visible', type: 'boolean', default: true },
|
|
31
|
+
];
|
|
32
|
+
const PROP_BY_NAME = new Map(UI_PROPS.map(p => [p.path, p]));
|
|
33
|
+
/** `ui:<layerKey>` → layerKey, else null. */
|
|
34
|
+
export function uiLayerOf(state) {
|
|
35
|
+
return state.startsWith(UI_STATE_PREFIX) && state.length > UI_STATE_PREFIX.length ? state.slice(UI_STATE_PREFIX.length) : null;
|
|
36
|
+
}
|
|
37
|
+
/** `<elementId>.<prop>` → [elementId, prop spec], else null (unknown prop or no id). */
|
|
38
|
+
export function uiPathOf(path) {
|
|
39
|
+
const dot = path.lastIndexOf('.');
|
|
40
|
+
if (dot <= 0)
|
|
41
|
+
return null;
|
|
42
|
+
const spec = PROP_BY_NAME.get(path.slice(dot + 1));
|
|
43
|
+
if (!spec)
|
|
44
|
+
return null;
|
|
45
|
+
const id = path.slice(0, dot);
|
|
46
|
+
return id ? [id, spec] : null;
|
|
47
|
+
}
|
|
48
|
+
export const isUiTrackPath = (state, path) => uiLayerOf(state) !== null && uiPathOf(path) !== null;
|
|
49
|
+
// --- element lookup (cached per frame-run; a re-rendered layer gets a new root) -------
|
|
50
|
+
const elementCache = new Map();
|
|
51
|
+
export function clearUiTrackCaches() { elementCache.clear(); }
|
|
52
|
+
function elementFor(layerKey, id) {
|
|
53
|
+
const runtime = getUiLayerRuntime(layerKey);
|
|
54
|
+
if (!runtime)
|
|
55
|
+
return null;
|
|
56
|
+
const key = `${layerKey}\u0000${id}`;
|
|
57
|
+
const cached = elementCache.get(key);
|
|
58
|
+
if (cached && cached.root === runtime.root && cached.el.isConnected)
|
|
59
|
+
return cached.el;
|
|
60
|
+
const el = runtime.root.getElementById(id);
|
|
61
|
+
if (el)
|
|
62
|
+
elementCache.set(key, { root: runtime.root, el });
|
|
63
|
+
else
|
|
64
|
+
elementCache.delete(key);
|
|
65
|
+
return el;
|
|
66
|
+
}
|
|
67
|
+
/** Whether a layer is rendered and has the element (undefined id = the layer alone). */
|
|
68
|
+
export function isUiTargetMounted(state, path) {
|
|
69
|
+
const layerKey = uiLayerOf(state);
|
|
70
|
+
if (!layerKey)
|
|
71
|
+
return false;
|
|
72
|
+
if (!path)
|
|
73
|
+
return !!getUiLayerRuntime(layerKey);
|
|
74
|
+
const at = uiPathOf(path);
|
|
75
|
+
return !!at && !!elementFor(layerKey, at[0]);
|
|
76
|
+
}
|
|
77
|
+
const VAR_OF = { opacity: '--rise-opacity', x: '--rise-x', y: '--rise-y', xv: '--rise-xv', yv: '--rise-yv', scale: '--rise-scale', rotate: '--rise-rotate' };
|
|
78
|
+
/** xv / yv are written unitless (the stylesheet multiplies by 1cqw / 1cqh). */
|
|
79
|
+
const UNIT_OF = { x: 'px', y: 'px', rotate: 'deg' };
|
|
80
|
+
/** Write one sampled value. False when the layer or element is not rendered. */
|
|
81
|
+
export function applyUiValue(state, path, value) {
|
|
82
|
+
const layerKey = uiLayerOf(state);
|
|
83
|
+
const at = layerKey ? uiPathOf(path) : null;
|
|
84
|
+
if (!layerKey || !at)
|
|
85
|
+
return false;
|
|
86
|
+
const el = elementFor(layerKey, at[0]);
|
|
87
|
+
if (!el)
|
|
88
|
+
return false;
|
|
89
|
+
const prop = at[1].path;
|
|
90
|
+
if (prop === 'visible') {
|
|
91
|
+
const on = value === true || value === 1 || value === 'true';
|
|
92
|
+
if (on)
|
|
93
|
+
el.removeAttribute('hidden');
|
|
94
|
+
else
|
|
95
|
+
el.setAttribute('hidden', '');
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
const n = typeof value === 'number' ? value : Number(value);
|
|
99
|
+
if (!Number.isFinite(n))
|
|
100
|
+
return false;
|
|
101
|
+
el.style.setProperty(VAR_OF[prop], `${n}${UNIT_OF[prop] ?? ''}`);
|
|
102
|
+
if (!el.hasAttribute('data-rise-anim'))
|
|
103
|
+
el.setAttribute('data-rise-anim', '');
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
/** The track's value as the element shows it now (its var, else the prop's natural value). */
|
|
107
|
+
export function readUiValue(state, path) {
|
|
108
|
+
const layerKey = uiLayerOf(state);
|
|
109
|
+
const at = layerKey ? uiPathOf(path) : null;
|
|
110
|
+
if (!layerKey || !at)
|
|
111
|
+
return undefined;
|
|
112
|
+
const el = elementFor(layerKey, at[0]);
|
|
113
|
+
if (!el)
|
|
114
|
+
return undefined;
|
|
115
|
+
const prop = at[1].path;
|
|
116
|
+
if (prop === 'visible')
|
|
117
|
+
return !el.hasAttribute('hidden');
|
|
118
|
+
const raw = el.style.getPropertyValue(VAR_OF[prop]);
|
|
119
|
+
const n = raw ? parseFloat(raw) : NaN;
|
|
120
|
+
return Number.isFinite(n) ? n : at[1].default;
|
|
121
|
+
}
|
|
122
|
+
/** The track stops: its var comes off; with none left, so does the mark. `visible` returns to the layer's own (shown). */
|
|
123
|
+
export function releaseUiValue(state, path) {
|
|
124
|
+
const layerKey = uiLayerOf(state);
|
|
125
|
+
const at = layerKey ? uiPathOf(path) : null;
|
|
126
|
+
if (!layerKey || !at)
|
|
127
|
+
return false;
|
|
128
|
+
const el = elementFor(layerKey, at[0]);
|
|
129
|
+
if (!el)
|
|
130
|
+
return true;
|
|
131
|
+
const prop = at[1].path;
|
|
132
|
+
if (prop === 'visible') {
|
|
133
|
+
el.removeAttribute('hidden');
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
el.style.removeProperty(VAR_OF[prop]);
|
|
137
|
+
if (!Object.values(VAR_OF).some(v => el.style.getPropertyValue(v)))
|
|
138
|
+
el.removeAttribute('data-rise-anim');
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
/** Elements of a rendered layer that can be animated (those with an id), for pickers. */
|
|
142
|
+
export function uiAnimatableElements(layerKey) {
|
|
143
|
+
const runtime = getUiLayerRuntime(layerKey);
|
|
144
|
+
if (!runtime)
|
|
145
|
+
return [];
|
|
146
|
+
const out = [];
|
|
147
|
+
runtime.root.querySelectorAll('[id]').forEach(el => {
|
|
148
|
+
const text = (el.textContent ?? '').trim().replace(/\s+/g, ' ');
|
|
149
|
+
out.push({ id: el.id, tag: el.tagName.toLowerCase(), text: text.length > 40 ? `${text.slice(0, 40)}…` : text });
|
|
150
|
+
});
|
|
151
|
+
return out;
|
|
152
|
+
}
|
|
@@ -73,7 +73,7 @@ export interface SceneValues {
|
|
|
73
73
|
* path is not writable (see `check`).
|
|
74
74
|
*/
|
|
75
75
|
set(target: string, path: string, value: SceneValue): boolean;
|
|
76
|
-
/** The value now:
|
|
76
|
+
/** The value as the scene shows it now: a running clip's value, a live write, else the authored value (action patches included). */
|
|
77
77
|
get(target: string, path: string): SceneValue | undefined;
|
|
78
78
|
/** Why `set` would fail, or undefined when it can write this path. */
|
|
79
79
|
check(target: string, path: string): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sceneHandle.d.ts","sourceRoot":"","sources":["../../src/api/sceneHandle.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAG1E,OAAO,EAAc,KAAK,gBAAgB,EAAuB,MAAM,aAAa,CAAC;AAErF,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE9E,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,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;IAC/B,yFAAyF;IACzF,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/E;AAoBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,iBAAiB,GAAG,WAAW,CAiRjF"}
|
package/dist/api/sceneHandle.js
CHANGED
|
@@ -169,13 +169,13 @@ export function createSceneHandle(getSource) {
|
|
|
169
169
|
const s = findSequence(ref);
|
|
170
170
|
if (!s)
|
|
171
171
|
return false;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return true;
|
|
172
|
+
// One engine, one path: a sequence driven from outside starts exactly like the studio's own
|
|
173
|
+
// scroll - played (it waits for its targets, then captures its "from current" values once)
|
|
174
|
+
// and following the target with its own smoothing. poseSequence is the editor's playhead only.
|
|
175
|
+
if (!ClipsRuntime.isSequenceActive(s.id))
|
|
176
|
+
ClipsRuntime.playSequence(s, clipsById(), { from: 0, waitForTargets: true });
|
|
177
|
+
// external: from here on this sequence has one input - the caller; the viewer's own wheel / touch / pointer leave it alone
|
|
178
|
+
return ClipsRuntime.setSequenceProgress(s.id, progress, { external: true });
|
|
179
179
|
},
|
|
180
180
|
getProgress(ref) {
|
|
181
181
|
const s = findSequence(ref);
|
|
@@ -264,9 +264,10 @@ export function createSceneHandle(getSource) {
|
|
|
264
264
|
if (!t)
|
|
265
265
|
return undefined;
|
|
266
266
|
const c = component(t.state, t.node, path);
|
|
267
|
+
// what the scene shows now: a running clip's value, a blend-out, a live write, else the authored value
|
|
267
268
|
if (c)
|
|
268
|
-
return ClipsRuntime.
|
|
269
|
-
return ClipsRuntime.
|
|
269
|
+
return ClipsRuntime.getCurrentValue(t.state, c.base, t.node)?.[c.index];
|
|
270
|
+
return ClipsRuntime.getCurrentValue(t.state, path, t.node);
|
|
270
271
|
},
|
|
271
272
|
};
|
|
272
273
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uiBaseStyles.d.ts","sourceRoot":"","sources":["../../src/ui/uiBaseStyles.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"uiBaseStyles.d.ts","sourceRoot":"","sources":["../../src/ui/uiBaseStyles.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,WAAW,QA0FvB,CAAC"}
|
package/dist/ui/uiBaseStyles.js
CHANGED
|
@@ -21,6 +21,7 @@ export const UI_BASE_CSS = /* css */ `
|
|
|
21
21
|
:host {
|
|
22
22
|
${hostVars}
|
|
23
23
|
display: block; position: absolute; inset: 0; pointer-events: none; overflow: hidden;
|
|
24
|
+
container-type: size; /* cqw / cqh = the layer's (the scene's) size, for the timeline's xv / yv */
|
|
24
25
|
font-family: ${v('--rise-font')}; font-size: 14px; line-height: 1.4; color: ${v('--rise-text')};
|
|
25
26
|
}
|
|
26
27
|
*, *::before, *::after { box-sizing: border-box; }
|
|
@@ -34,6 +35,15 @@ button, a, input, select, [data-click], [data-hover-in], [data-hover-out],
|
|
|
34
35
|
[data-offscreen] { visibility: hidden; pointer-events: none !important; }
|
|
35
36
|
[data-occluded] { opacity: 0; pointer-events: none !important; }
|
|
36
37
|
|
|
38
|
+
/* Timeline-driven elements (uiTracks): the vars the runtime writes become the individual
|
|
39
|
+
transform properties, so they compose with any \`transform\` the layer or an anchor sets. */
|
|
40
|
+
[data-rise-anim] {
|
|
41
|
+
translate: calc(var(--rise-x, 0px) + var(--rise-xv, 0) * 1cqw) calc(var(--rise-y, 0px) + var(--rise-yv, 0) * 1cqh) !important;
|
|
42
|
+
scale: var(--rise-scale, 1) !important;
|
|
43
|
+
rotate: var(--rise-rotate, 0deg) !important;
|
|
44
|
+
opacity: var(--rise-opacity, 1) !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
37
47
|
.rise-panel, .rise-menu, .rise-card {
|
|
38
48
|
background: ${v('--rise-bg')}; border: 1px solid ${v('--rise-border')}; border-radius: ${v('--rise-radius')};
|
|
39
49
|
-webkit-backdrop-filter: blur(${v('--rise-blur')}); backdrop-filter: blur(${v('--rise-blur')});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@3driseai/3drise-viewer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"typescript": "^5.7.2"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@3driseai/3drise-core": "^1.0.
|
|
44
|
+
"@3driseai/3drise-core": "^1.0.34",
|
|
45
45
|
"three-mesh-bvh": "^0.8.3"
|
|
46
46
|
}
|
|
47
47
|
}
|