feat: drive signs from a shared animation clock

This commit is contained in:
2026-09-02 14:14:18 +03:00
parent 24afda8710
commit f2dd3f85dd
9 changed files with 615 additions and 265 deletions

View File

@@ -573,6 +573,7 @@ function copyJourneySnapshot(snapshot: JourneySnapshot): JourneySnapshot {
targetId: snapshot.sign.targetId,
phase: snapshot.sign.phase,
progress: finite(snapshot.sign.progress),
opacity: finite(snapshot.sign.opacity),
} : null,
arrived: Boolean(snapshot.arrived),
};

View File

@@ -68,11 +68,18 @@ export function createSign(resources: SceneResourceBag) {
return {
group,
update(sign: SignSnapshot | null) {
group.visible = sign !== null;
group.visible = sign !== null && sign.opacity > 0;
if (!sign) return;
updateTexture(sign.targetId);
const phaseOffset = sign.phase === 'approach' ? -26 : sign.phase === 'stabilized' ? -5 : 8;
group.position.set(7.2, 4.1, phaseOffset + sign.progress * 8);
material.opacity = sign.opacity;
const phaseOffset = sign.phase === 'anticipate'
? -30
: sign.phase === 'approach'
? -26 + sign.progress * 21
: sign.phase === 'dwell'
? -5
: -5 + sign.progress * 18;
group.position.set(7.2, 4.1, phaseOffset);
group.rotation.y = -0.12;
},
};