From 3ff9fc18a7db9f16ffef6c7b11fd7ae8af4076fa Mon Sep 17 00:00:00 2001 From: tfrere Date: Fri, 21 Aug 2026 16:08:47 +0200 Subject: [PATCH] feat: jukebox corner prop materializing with the ceremony Co-authored-by: Cursor --- .gitattributes | 1 + assets/props/jukebox.glb | 3 ++ ceremony.js | 65 ++++++++++++++++++++++++++++++++++++++++ index.html | 2 +- rl.js | 46 ++++++++++++++++++++++++++++ 5 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 assets/props/jukebox.glb diff --git a/.gitattributes b/.gitattributes index 38b1230..68528d4 100644 --- a/.gitattributes +++ b/.gitattributes @@ -37,3 +37,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text *.wav filter=lfs diff=lfs merge=lfs -text *.png filter=lfs diff=lfs merge=lfs -text *.webp filter=lfs diff=lfs merge=lfs -text +*.glb filter=lfs diff=lfs merge=lfs -text diff --git a/assets/props/jukebox.glb b/assets/props/jukebox.glb new file mode 100644 index 0000000..7ce07ba --- /dev/null +++ b/assets/props/jukebox.glb @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c57bd4676e7f3889692b1f9afe9e799fc4dfe2c97405e53cd1e5ed9b30d83059 +size 1759760 diff --git a/ceremony.js b/ceremony.js index b4c789c..1e6e4c2 100644 --- a/ceremony.js +++ b/ceremony.js @@ -38,6 +38,12 @@ export function createCeremony({ let fxRig = null; let fxPrev = null; + // Decorative props (addPropFx): each owns a wireframe FX bound to its + // own root. They cue whenever the duck's scan cues (entrance and every + // respawn), offset by their stagger, and drive on their OWN clock so a + // late-finishing prop never extends the input lock or the ceremony's + // completion checks. + const props = []; // { fx, delayS, at, started, prev } let entranceT0 = null; let entranceFxCued = false; let entranceDone = false; @@ -60,6 +66,54 @@ export function createCeremony({ bind(); fx.start(); fxPrev = performance.now(); + propsCue(); + } + function propsCue() { + const now = performance.now(); + for (const p of props) { + p.at = now + p.delayS * 1000; + p.started = false; + p.prev = null; + } + } + function propsHide() { + for (const p of props) { + p.fx.setProgress(0); + p.at = null; + p.started = false; + } + } + function propsFinish() { + for (const p of props) { + if (!p.started) p.fx.start(); + p.fx.update(1e3); + p.at = null; + } + } + // Deterministic screenshot/test hook (setFx): park every prop at the + // same scan progress as the duck, detached from the timed driver. + function propsSetProgress(v) { + for (const p of props) { + p.fx.setProgress(v); + p.at = null; + p.started = false; + } + } + function driveProps() { + const now = performance.now(); + for (const p of props) { + if (p.at === null || now < p.at) continue; + if (!p.started) { + p.fx.start(); + p.started = true; + p.prev = now; + continue; + } + if (p.fx.isDone()) continue; + const dt = Math.min((now - p.prev) / 1000, 0.25); + p.prev = now; + p.fx.update(dt); + } } function fxDrive() { if (fxPrev === null || fx.isDone()) return; @@ -111,6 +165,7 @@ export function createCeremony({ startCameraReset(); syncRig(); fx.setProgress(0); + propsHide(); respawn = { t0: performance.now(), scanCued: false }; } @@ -131,6 +186,7 @@ export function createCeremony({ function drive() { driveEntrance(); driveRespawn(); + driveProps(); } function setReveal(floor, wall = floor) { @@ -146,13 +202,21 @@ export function createCeremony({ if (p >= 1) { fx.start(); fxForceFinish(); + propsFinish(); setLocked(false); entranceFinishedResolve(); } else { fx.setProgress(p); + propsSetProgress(p); } } + // Register a decorative prop's wireframe FX (already init'd on its own + // root, hidden). It materializes delayS after each duck scan cue. + function addPropFx(propFx, delayS = 0) { + props.push({ fx: propFx, delayS, at: null, started: false, prev: null }); + } + // Boot hidden: clip parked below the feet from the first frame. bind(); @@ -164,6 +228,7 @@ export function createCeremony({ bind, setReveal, setFx, + addPropFx, entranceFinished, get entranceDone() { return entranceDone; }, get respawnActive() { return respawn !== null; }, diff --git a/index.html b/index.html index 13ab2bd..85f02d3 100644 --- a/index.html +++ b/index.html @@ -1376,7 +1376,7 @@ appended: a plain src attribute can 401 when the browser blocks the *.static.hf.space auth cookie inside the hub iframe. -->