@@ -4,9 +4,7 @@ import { useRef, useState, useEffect, type ReactNode } from 'react';
44import gsap from 'gsap' ;
55import { ScrollTrigger } from 'gsap/ScrollTrigger' ;
66
7- if ( typeof window !== 'undefined' ) {
8- gsap . registerPlugin ( ScrollTrigger ) ;
9- }
7+ let gsapRegistered = false ;
108
119/* ─── Types ─── */
1210interface FeatureCardProps {
@@ -44,7 +42,7 @@ function FloatingParticle({
4442 tl . to ( ref . current , {
4543 opacity : 0.6 ,
4644 y : - 60 ,
47- x : ` random(-30, 30)` ,
45+ x : Math . random ( ) * 60 - 30 ,
4846 duration : duration * 0.4 ,
4947 ease : 'power2.out' ,
5048 } )
@@ -119,8 +117,6 @@ function AnimatedBorder({ color, isHovered }: { color: string; isHovered: boolea
119117 style = { {
120118 opacity : 0 ,
121119 background : `conic-gradient(from 0deg, transparent, ${ color } , transparent, ${ color } 44, transparent)` ,
122- mask : 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)' ,
123- maskComposite : 'exclude' ,
124120 WebkitMaskComposite : 'xor' ,
125121 padding : '1.5px' ,
126122 } }
@@ -417,6 +413,13 @@ export function FeatureCard({ icon, title, desc, accent, index, accentColor }: F
417413
418414/* ─── Section Wrapper (optional heading + background glow) ─── */
419415export function FeatureCardsSection ( { children } : { children : ReactNode } ) {
416+ useEffect ( ( ) => {
417+ if ( ! gsapRegistered ) {
418+ gsap . registerPlugin ( ScrollTrigger ) ;
419+ gsapRegistered = true ;
420+ }
421+ } , [ ] ) ;
422+
420423 const sectionRef = useRef < HTMLDivElement > ( null ) ;
421424 const headingRef = useRef < HTMLHeadingElement > ( null ) ;
422425
0 commit comments