feat: layer the nightdrive sky and atmosphere

This commit is contained in:
2026-09-02 14:52:03 +03:00
parent 3c932cb840
commit 5c52de9134
15 changed files with 801 additions and 168 deletions

View File

@@ -74,13 +74,14 @@ export function createScrollDriveController(): ScrollDriveController {
return cruiseSnapshot(input);
}
const deltaY = input.scrollY - previousSample.scrollY;
const direction: -1 | 0 | 1 = deltaY > 0 ? 1 : deltaY < 0 ? -1 : 0;
if (elapsedMs > BACKGROUND_GAP_MS) {
previousSample = { ...input };
smoothedAcceleration = 0;
return cruiseSnapshot(input);
return { ...cruiseSnapshot(input), direction };
}
const deltaY = input.scrollY - previousSample.scrollY;
const rawSpeed = Math.abs(deltaY) / elapsedMs;
const impulse = clamp(rawSpeed / MAX_RAW_SPEED, 0, 1);
const timeConstantMs = impulse > smoothedAcceleration
@@ -93,7 +94,6 @@ export function createScrollDriveController(): ScrollDriveController {
}
previousSample = { ...input };
const direction: -1 | 0 | 1 = deltaY > 0 ? 1 : deltaY < 0 ? -1 : 0;
return {
scrollY: input.scrollY,
routeProgress: routeProgress(input),