"use client";
import Lenis from "@studio-freight/lenis";
import { useEffect } from "react";
export const LenisScroller = () => {
useEffect(() => {
const lenis = new Lenis();
lenis.on("scroll", (e: any) => {
console.log(e);
});
function raf(time: number) {
lenis.raf(time);
requestAnimationFrame(raf);
}
requestAnimationFrame(raf);
return () => {
lenis.destroy();
};
}, []);
return <></>;
};
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter