feat: drive signs from a shared animation clock
This commit is contained in:
@@ -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),
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user