1+ import { useEffect , useRef } from "react" ;
2+ import gsap from "gsap" ;
3+ import { ScrollTrigger } from "gsap/ScrollTrigger" ;
14import AboutMe from "./components/aboutMe" ;
25import Beams from "./components/blocks/Backgrounds/Beams/Beams" ;
36import Hero from "./components/hero" ;
@@ -7,9 +10,42 @@ import Projects from "./components/projects";
710import Contact from "./components/contact" ;
811import Footer from "./components/footer" ;
912
13+ gsap . registerPlugin ( ScrollTrigger ) ;
14+
1015export default function App ( ) {
16+ const mainRef = useRef < HTMLDivElement > ( null ) ;
17+
18+ useEffect ( ( ) => {
19+ const ctx = gsap . context ( ( ) => {
20+ const sections = gsap . utils . toArray < HTMLElement > ( ".reveal-section" ) ;
21+
22+ sections . forEach ( ( section ) => {
23+ gsap . fromTo (
24+ section ,
25+ { autoAlpha : 0 , y : 20 } ,
26+ {
27+ autoAlpha : 1 ,
28+ y : 0 ,
29+ duration : 0.8 ,
30+ ease : "power1.out" ,
31+ scrollTrigger : {
32+ trigger : section ,
33+ start : "top 92%" ,
34+ end : "bottom 8%" ,
35+ toggleActions : "play reverse play reverse" ,
36+ // Using scrub: false but keeping it light
37+ invalidateOnRefresh : true ,
38+ } ,
39+ }
40+ ) ;
41+ } ) ;
42+ } , mainRef ) ;
43+
44+ return ( ) => ctx . revert ( ) ;
45+ } , [ ] ) ;
46+
1147 return (
12- < div className = "relative w-full min-h-screen overflow-auto dark" >
48+ < div className = "relative w-full min-h-screen overflow-x-hidden dark" ref = { mainRef } >
1349 < div className = "fixed inset-0 z-10 pointer-events-none" >
1450 < Beams
1551 beamWidth = { 2 }
@@ -28,12 +64,24 @@ export default function App() {
2864 </ header >
2965
3066 < main className = "relative z-10 mt-4 merienda" >
31- < Hero imageSrc = "/assets/profile_pic_2.png" />
32- < Skills />
33- < AboutMe />
34- < Projects />
35- < Contact />
36- < Footer />
67+ < div className = "reveal-section" >
68+ < Hero imageSrc = "/assets/profile_pic_2.png" />
69+ </ div >
70+ < div className = "reveal-section" >
71+ < Skills />
72+ </ div >
73+ < div className = "reveal-section" >
74+ < AboutMe />
75+ </ div >
76+ < div className = "reveal-section" >
77+ < Projects />
78+ </ div >
79+ < div className = "reveal-section" >
80+ < Contact />
81+ </ div >
82+ < div className = "reveal-section" >
83+ < Footer />
84+ </ div >
3785 </ main >
3886 </ div >
3987 ) ;
0 commit comments