Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Improve parallax effect

Blue Mouseb7d7f7fa8e72
diff --git a/web/app/routes/_index.tsx b/web/app/routes/_index.tsx
index 27990d57a..c9566260d 100644
--- a/web/app/routes/_index.tsx
+++ b/web/app/routes/_index.tsx
@@ -569,18 +569,17 @@ const OldHero = ({ stats }: { stats: Stats | null }) => {
)
}
-// Parallax: the forest image lags the scroll by translating down up to 200px
-// over the first 1000px of scroll. The wrapper extends 200px above the hero
-// (-top-50) so the travel never reveals a gap at the top.
const HeroParallaxBackground = () => {
const reduceMotion = useReducedMotion()
const { scrollY } = useScroll()
- const y = useTransform(scrollY, [0, 1000], [0, 200])
+ const scale = useTransform(scrollY, [0, 900], [1, 1.08])
return (
<motion.div
- className='absolute inset-x-0 -top-50 bottom-0'
- style={reduceMotion ? undefined : { y }}
+ className='absolute inset-0 transform-gpu'
+ style={
+ reduceMotion ? undefined : { scale, transformOrigin: 'center 35%' }
+ }
>
<picture className='absolute inset-0 block'>
<source srcSet='/assets/hero-background.avif' type='image/avif' />