|
1269 | 1269 | let rafId = 0; |
1270 | 1270 | let transitionSpan = 1; |
1271 | 1271 | let transitionDistance = 1; |
1272 | | - let lowerLayerStartShift = 58; |
| 1272 | + let lowerLayerStartShift = 28; |
1273 | 1273 | let lastBackdropSuppression = ""; |
1274 | 1274 | const atmosphereTargets = { |
1275 | 1275 | htmlWarm: 0.08, |
|
1298 | 1298 | stageReference * 1.78, |
1299 | 1299 | viewportHeight * 1.42 |
1300 | 1300 | ); |
1301 | | - lowerLayerStartShift = Math.min(Math.max(viewportHeight * 0.07, 36), 84); |
| 1301 | + lowerLayerStartShift = Math.min(Math.max(viewportHeight * 0.032, 18), 34); |
| 1302 | + const lowerLayerOverlap = Math.max( |
| 1303 | + Math.min(viewportHeight * 0.72, stageReference * 1.02), |
| 1304 | + viewportHeight * 0.56 |
| 1305 | + ); |
1302 | 1306 | hero.style.setProperty("--home-transition-distance", `${transitionDistance.toFixed(2)}px`); |
| 1307 | + root.style.setProperty("--home-next-layer-overlap", `${lowerLayerOverlap.toFixed(2)}px`); |
1303 | 1308 | }; |
1304 | 1309 |
|
1305 | 1310 | const setAtmosphere = (amount) => { |
|
1320 | 1325 | rafId = 0; |
1321 | 1326 |
|
1322 | 1327 | const progress = clamp(getScrollTop() / transitionDistance, 0, 1); |
1323 | | - const uiOpacity = 1 - range(progress, 0.02, 0.7, linear); |
1324 | | - const imageScale = lerp(1, 1.12, range(progress, 0, 0.8, easeOutCubic)); |
1325 | | - const baseFade = 1 - range(progress, 0.06, 0.76, linear); |
1326 | | - const baseBrightness = lerp(1, 0.7, range(progress, 0.08, 0.72, easeInOutCubic)); |
1327 | | - const baseContrast = lerp(1, 0.93, range(progress, 0.08, 0.72, easeInOutCubic)); |
1328 | | - const silhouetteAppear = range(progress, 0.16, 0.44, easeInOutCubic); |
1329 | | - const silhouetteFade = 1 - range(progress, 0.46, 0.76, easeInOutCubic); |
1330 | | - const silhouetteOpacity = 0.8 * silhouetteAppear * silhouetteFade; |
1331 | | - const gradientOpacity = Math.max(0, baseFade); |
1332 | | - const atmosphereProgress = range(progress, 0.42, 0.74, easeInOutCubic); |
1333 | | - const nextLayerProgress = range(progress, 0.38, 0.76, easeInOutCubic); |
1334 | | - const backdropSuppression = progress < 0.78 ? "1" : "0"; |
| 1328 | + const uiOpacity = 1 - range(progress, 0.06, 0.62, linear); |
| 1329 | + const imageScale = lerp(1, 1.125, range(progress, 0, 0.74, easeOutCubic)); |
| 1330 | + const baseFade = 1 - range(progress, 0.08, 0.56, linear); |
| 1331 | + const baseBrightness = lerp(1, 0.68, range(progress, 0.1, 0.54, easeInOutCubic)); |
| 1332 | + const baseContrast = lerp(1, 0.92, range(progress, 0.12, 0.54, easeInOutCubic)); |
| 1333 | + const silhouetteAppear = range(progress, 0.2, 0.34, easeInOutCubic); |
| 1334 | + const silhouetteFade = 1 - range(progress, 0.34, 0.58, easeInOutCubic); |
| 1335 | + const silhouetteOpacity = 0.74 * silhouetteAppear * silhouetteFade; |
| 1336 | + const heroUnitOpacity = Math.max(baseFade, silhouetteOpacity); |
| 1337 | + const atmosphereProgress = range(progress, 0.62, 0.88, easeInOutCubic); |
| 1338 | + const nextLayerProgress = range(progress, 0.58, 0.84, easeInOutCubic); |
| 1339 | + const backdropSuppression = progress < 0.88 ? "1" : "0"; |
1335 | 1340 |
|
1336 | 1341 | root.style.setProperty("--home-ui-opacity", Math.max(0, uiOpacity).toFixed(4)); |
1337 | 1342 | root.style.setProperty("--home-image-scroll-scale", imageScale.toFixed(4)); |
| 1343 | + root.style.setProperty("--home-image-unit-opacity", Math.max(0, heroUnitOpacity).toFixed(4)); |
1338 | 1344 | root.style.setProperty("--home-image-base-layer-opacity", Math.max(0, baseFade).toFixed(4)); |
1339 | 1345 | root.style.setProperty("--home-image-base-brightness", baseBrightness.toFixed(4)); |
1340 | 1346 | root.style.setProperty("--home-image-base-contrast", baseContrast.toFixed(4)); |
1341 | 1347 | root.style.setProperty("--home-image-silhouette-layer-opacity", Math.max(0, silhouetteOpacity).toFixed(4)); |
1342 | | - root.style.setProperty("--home-image-gradient-opacity", Math.max(0, gradientOpacity).toFixed(4)); |
1343 | 1348 | setAtmosphere(atmosphereProgress); |
1344 | 1349 | setLowerLayer(nextLayerProgress); |
1345 | 1350 |
|
|
1370 | 1375 | if (prefersReducedMotion) { |
1371 | 1376 | root.style.setProperty("--home-ui-opacity", "1"); |
1372 | 1377 | root.style.setProperty("--home-image-scroll-scale", "1"); |
| 1378 | + root.style.setProperty("--home-image-unit-opacity", "1"); |
1373 | 1379 | root.style.setProperty("--home-image-base-layer-opacity", "1"); |
1374 | 1380 | root.style.setProperty("--home-image-base-brightness", "1"); |
1375 | 1381 | root.style.setProperty("--home-image-base-contrast", "1"); |
1376 | 1382 | root.style.setProperty("--home-image-silhouette-layer-opacity", "0"); |
1377 | | - root.style.setProperty("--home-image-gradient-opacity", "1"); |
1378 | 1383 | setAtmosphere(1); |
1379 | 1384 | setLowerLayer(1); |
1380 | 1385 | body.dataset.homeBackdropSuppressed = "0"; |
|
0 commit comments