fix(scene): cut the opening crane to the chase framing on any interaction

This commit is contained in:
2026-10-10 20:50:47 +03:00
parent d9cdbbbde2
commit 8044ad88e3

View File

@@ -187,7 +187,6 @@ export async function createProceduralSceneGeneration(
// Opening shot: a crane down from the sun to the chase position. It plays // Opening shot: a crane down from the sun to the chase position. It plays
// once, only when the visit starts at the top, and a scroll hurries it. // once, only when the visit starts at the top, and a scroll hurries it.
let introProgress: number | null = null; let introProgress: number | null = null;
let introHurried = false;
let introFrames = 0; let introFrames = 0;
let introSlowFrames = 0; let introSlowFrames = 0;
@@ -521,20 +520,21 @@ export async function createProceduralSceneGeneration(
if (introProgress === 0) renderer.compile(scene, camera); if (introProgress === 0) renderer.compile(scene, camera);
} }
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. Scrolling,
// or navigate it lands within INTRO_LANDING_SECONDS of wall time: a sign // navigating or a sign on its way cuts straight to the chase framing:
// latches its placement after its 300 ms anticipation, so the chase // signs latch their placement against that camera.
// framing must be back before then. if (
if (snapshot.scrollY > 40 || snapshot.activeSectionId !== 'start') introHurried = true; snapshot.scrollY > 40
// A crane that stutters is worse than none: on a device that cannot || snapshot.activeSectionId !== 'start'
// hold the shot smoothly, land it straight away. || snapshot.sign !== null
// The first frames carry shader compilation and a lone hitch (a late ) introProgress = 1;
// texture upload) is forgiven; three slow frames end the shot. // A crane that stutters is worse than none. The first frames carry
// shader compilation and a lone hitch is forgiven; three slow frames
// end the shot.
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) introProgress = 1;
const step = introHurried ? Math.min(0.5, wallSeconds) / INTRO_LANDING_SECONDS : deltaSeconds / INTRO_SECONDS; introProgress = Math.min(1, introProgress + deltaSeconds / INTRO_SECONDS);
introProgress = Math.min(1, introProgress + step);
} }
const crane = easeInOutCubic( const crane = easeInOutCubic(
THREE.MathUtils.clamp((introProgress - 0.06) / 0.94, 0, 1), THREE.MathUtils.clamp((introProgress - 0.06) / 0.94, 0, 1),
@@ -619,7 +619,6 @@ 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 {