feat: layer the nightdrive sky and atmosphere
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user