can someone please tell me why am I getting the error like below
Object literal may only specify known properties, and 'direction' does not exist in type 'LenisOptions'
"use client";
import { ReactNode, useEffect } from "react";
import Lenis from "@studio-freight/lenis";
export default function SmoothScroll({ children }: { children: ReactNode }) {
useEffect(() => {
const lenis = new Lenis({
duration: 1.2,
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
direction: "vertical",
smooth: true,
smoothTouch: false,
touchMultiplier: 2,
});
function raf(time: number) {
lenis.raf(time);
requestAnimationFrame(raf);
}
requestAnimationFrame(raf);
return () => {
lenis.destroy();
};
}, []);
return <>{children}</>;
}
can someone please tell me why am I getting the error like below
Object literal may only specify known properties, and 'direction' does not exist in type 'LenisOptions'
"use client";
import { ReactNode, useEffect } from "react";
import Lenis from "@studio-freight/lenis";
export default function SmoothScroll({ children }: { children: ReactNode }) {
useEffect(() => {
const lenis = new Lenis({
duration: 1.2,
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
direction: "vertical",
smooth: true,
smoothTouch: false,
touchMultiplier: 2,
});
function raf(time: number) {
lenis.raf(time);
requestAnimationFrame(raf);
}
requestAnimationFrame(raf);
return () => {
lenis.destroy();
};
}, []);
return <>{children}</>;
}
Share
Improve this question
asked 2 days ago
Tasfiq.AsifTasfiq.Asif
331 silver badge5 bronze badges
1
|
1 Answer
Reset to default 0below worked
"use client";
import { ReactNode, useEffect } from "react";
import Lenis from "@studio-freight/lenis";
export default function SmoothScroll({ children }: { children: ReactNode }) {
useEffect(() => {
const lenis = new Lenis({
duration: 1.2,
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
orientation: "vertical",
lerp: 0.1,
smoothWheel: true,
touchMultiplier: 2,
});
function raf(time: number) {
lenis.raf(time);
requestAnimationFrame(raf);
}
requestAnimationFrame(raf);
return () => {
lenis.destroy();
};
}, []);
return <>{children}</>;
}
orientation
– Daniel A. White Commented 2 days ago