fix(scene): land the opening crane before a sign can latch its placement

This commit is contained in:
2026-10-10 20:43:49 +03:00
parent 300ebac68a
commit d9cdbbbde2

View File

@@ -522,8 +522,9 @@ export async function createProceduralSceneGeneration(
} }
if (introProgress < 1) { if (introProgress < 1) {
// The shot belongs to a visitor who waits at the top. Once they scroll // The shot belongs to a visitor who waits at the top. Once they scroll
// or navigate it lands within about 0.4 s of wall time, so the chase // or navigate it lands within INTRO_LANDING_SECONDS of wall time: a sign
// framing (and every sign placed against it) is back before arrival. // latches its placement after its 300 ms anticipation, so the chase
// framing must be back before then.
if (snapshot.scrollY > 40 || snapshot.activeSectionId !== 'start') introHurried = true; if (snapshot.scrollY > 40 || snapshot.activeSectionId !== 'start') introHurried = true;
// A crane that stutters is worse than none: on a device that cannot // A crane that stutters is worse than none: on a device that cannot
// hold the shot smoothly, land it straight away. // hold the shot smoothly, land it straight away.
@@ -532,7 +533,7 @@ export async function createProceduralSceneGeneration(
introFrames += 1; introFrames += 1;
if (introFrames > 3 && wallSeconds > 0.1) introSlowFrames += 1; if (introFrames > 3 && wallSeconds > 0.1) introSlowFrames += 1;
if (introSlowFrames >= 3) introHurried = true; if (introSlowFrames >= 3) introHurried = true;
const step = introHurried ? Math.min(0.5, wallSeconds) / 0.4 : deltaSeconds / INTRO_SECONDS; const step = introHurried ? Math.min(0.5, wallSeconds) / INTRO_LANDING_SECONDS : deltaSeconds / INTRO_SECONDS;
introProgress = Math.min(1, introProgress + step); introProgress = Math.min(1, introProgress + step);
} }
const crane = easeInOutCubic( const crane = easeInOutCubic(
@@ -618,6 +619,7 @@ export async function createProceduralSceneGeneration(
}; };
} }
const INTRO_LANDING_SECONDS = 0.18;
const INTRO_SECONDS = 4.2; const INTRO_SECONDS = 4.2;
function easeInOutCubic(t: number): number { function easeInOutCubic(t: number): number {