Foundations / Lenis Smooth Scroll
Lenis provides buttery-smooth scroll inertia. Pair with GSAP ScrollTrigger for scroll-tied animations. This is an invisible utility — scroll this page to feel it.
Status
Loading...
Tip: Lenis works at the document level. On this demo page, smooth scroll is active if motion is not reduced. Scroll velocity and direction data are exposed for use with GSAP ScrollTrigger.
// Mechanisme: foundation-lenis-smooth-scroll // Kopieer 1-op-1, geen stijlkeuzes. import Lenis from 'https://esm.sh/@studio-freight/[email protected]'; import gsap from 'https://esm.sh/[email protected]'; import { ScrollTrigger } from 'https://esm.sh/[email protected]/ScrollTrigger'; gsap.registerPlugin(ScrollTrigger); if (!window.matchMedia('(prefers-reduced-motion: reduce)').matches) { const lenis = new Lenis(); lenis.on('scroll', ScrollTrigger.update); gsap.ticker.add(time => lenis.raf(time * 1000)); gsap.ticker.lagSmoothing(0); }
<!-- Skeleton: foundation-lenis-smooth-scroll --> <!-- Add to <head> or main layout: --> <!-- Script with Lenis + GSAP integration --> <main> <section style="min-height:100vh;">Section 1</section> <section style="min-height:100vh;">Section 2</section> <section style="min-height:100vh;">Section 3</section> </main>
/* Styling: foundation-lenis-smooth-scroll */
/* No visual changes required — this is an invisible scroll utility */
html.lenis { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-scrolling iframe { pointer-events: none; }