You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

15 lines
506 B

export default async function useGSAP() {
// Only load GSAP on the client to avoid SSR issues
if (process.server) {
return { gsap: null, ScrollTrigger: null }
}
const gsapModule = await import('gsap')
const scrollModule = await import('gsap/ScrollTrigger')
const gsap = gsapModule.gsap ?? gsapModule.default ?? gsapModule
const ScrollTrigger = scrollModule.ScrollTrigger ?? scrollModule.default ?? scrollModule
gsap.registerPlugin?.(ScrollTrigger)
return { gsap, ScrollTrigger }
}