All librariesDocs
Scroll
Lenis
Buttery smooth scroll, used by award-winning sites.
Live demolenis
Lenis powers the smooth-scroll look on most award-winning creative sites. It plays nicely with native scroll APIs, works on a scoped element (like this demo) or on window.
Install
npm i lenis
Snippet
import Lenis from "lenis";
const lenis = new Lenis({
wrapper: ref.current, // or window
duration: 1.2,
easing: (t) => 1 - Math.pow(1 - t, 3),
});
function raf(time: number) {
lenis.raf(time);
requestAnimationFrame(raf);
}
requestAnimationFrame(raf);