Files
Montech_Landing/apps/landing/plugins/lenis.client.ts
T
MahdiandCursor 7e8e1b1f1b Initial Montech monorepo: Nuxt landing, Vue admin, Nest API.
Scaffold SSR site with CMS/blog/gallery/SEO admin and deploy configs for montech.ir.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-30 18:42:28 +03:30

20 lines
466 B
TypeScript

import Lenis from "lenis";
export default defineNuxtPlugin((nuxtApp) => {
if (!import.meta.client) return;
const lenis = new Lenis({ lerp: 0.09, smoothWheel: true });
let raf = 0;
const loop = (time: number) => {
lenis.raf(time);
raf = requestAnimationFrame(loop);
};
raf = requestAnimationFrame(loop);
nuxtApp.hook("app:unmounted", () => {
cancelAnimationFrame(raf);
lenis.destroy();
});
return {
provide: { lenis },
};
});