1
1
"use client" ;
2
2
3
3
import Image from "next/image" ;
4
- import { useRef , useEffect } from ' react' ;
5
- import { gsap } from ' gsap' ;
6
- import { ScrollTrigger } from ' gsap/ScrollTrigger' ;
4
+ import { useRef , useEffect } from " react" ;
5
+ import { gsap } from " gsap" ;
6
+ import { ScrollTrigger } from " gsap/ScrollTrigger" ;
7
7
8
8
gsap . registerPlugin ( ScrollTrigger ) ;
9
9
10
10
export default function About ( ) {
11
-
12
11
const leftRef = useRef ( null ) ;
13
12
const rightRef = useRef ( null ) ;
14
13
const containerRef = useRef ( null ) ;
15
14
16
15
useEffect ( ( ) => {
17
16
// Animation for left element(Image)
18
- gsap . fromTo ( leftRef . current ,
17
+ gsap . fromTo (
18
+ leftRef . current ,
19
19
{ opacity : 0 } ,
20
20
{
21
21
opacity : 1 ,
@@ -25,12 +25,13 @@ export default function About() {
25
25
trigger : containerRef . current ,
26
26
start : "top 60%" ,
27
27
end : "top 20%" ,
28
- scrub : 0.6 ,
29
- markers : false
30
- }
28
+ scrub : 0.6 ,
29
+ markers : false ,
30
+ } ,
31
31
}
32
32
) ;
33
- gsap . fromTo ( leftRef . current ,
33
+ gsap . fromTo (
34
+ leftRef . current ,
34
35
{ opacity : 1 } ,
35
36
{
36
37
opacity : 0 ,
@@ -40,19 +41,20 @@ export default function About() {
40
41
trigger : containerRef . current ,
41
42
start : "bottom 80%" ,
42
43
end : "bottom 30%" ,
43
- scrub : 0.6 ,
44
- markers : false
45
- }
44
+ scrub : 0.6 ,
45
+ markers : false ,
46
+ } ,
46
47
}
47
48
) ;
48
49
49
50
// Animation for right element(Text)
50
51
//open
51
- gsap . fromTo ( rightRef . current ,
52
- { x : '50%' , y :'-10%' , opacity : 0 } ,
52
+ gsap . fromTo (
53
+ rightRef . current ,
54
+ { x : "50%" , y : "-10%" , opacity : 0 } ,
53
55
{
54
56
x : 0 ,
55
- y :0 ,
57
+ y : 0 ,
56
58
opacity : 1 ,
57
59
duration : 1 ,
58
60
ease : "power3.in" ,
@@ -61,15 +63,17 @@ export default function About() {
61
63
start : "top 100%" ,
62
64
end : "top 20%" ,
63
65
scrub : 0.6 ,
64
- markers : false
65
- }
66
+ markers : false ,
67
+ } ,
66
68
}
67
69
) ;
68
70
//close
69
- gsap . fromTo ( rightRef . current ,
70
- { x : 0 , y :0 , opacity : 1 } ,
71
+ gsap . fromTo (
72
+ rightRef . current ,
73
+ { x : 0 , y : 0 , opacity : 1 } ,
71
74
{
72
- x : '50%' , y :'10%' ,
75
+ x : "50%" ,
76
+ y : "10%" ,
73
77
opacity : 0 ,
74
78
duration : 1 ,
75
79
ease : "power3.in" ,
@@ -78,60 +82,69 @@ export default function About() {
78
82
start : "top 0%" ,
79
83
end : "bottom 30%" ,
80
84
scrub : 0.6 ,
81
- markers : false
82
- }
85
+ markers : false ,
86
+ } ,
83
87
}
84
88
) ;
85
89
86
90
return ( ) => {
87
- ScrollTrigger . getAll ( ) . forEach ( trigger => trigger . kill ( ) ) ;
91
+ ScrollTrigger . getAll ( ) . forEach ( ( trigger ) => trigger . kill ( ) ) ;
88
92
} ;
89
93
} , [ ] ) ;
90
94
91
-
92
95
return (
93
- < section ref = { containerRef }
96
+ < section
97
+ ref = { containerRef }
94
98
className = "relative flex items-center justify-center h-screen md:px-20 lg:px-20"
95
- >
96
-
97
- < div className = "container mx-auto px-6 flex flex-col items-center" >
98
-
99
- < h2 className = "text-center text-4xl font-bold mb-10" > ABOUT </ h2 >
100
- < div className = "container mx-auto px-6 flex flex-col md:flex-row items-center" >
101
-
102
-
103
- { /* Image Section */ }
104
- < div className = "w-full md:w-1/3 flex justify-center md:justify-start hover:scale-101 transition-transform duration-300" ref = { leftRef } >
105
- < div className = "w-64 h-80 rounded-lg overflow-hidden border-4 border-primary shadow-lg" >
106
- < Image
107
- src = "/pics/pic2.jpg "
108
- alt = "Dushan"
109
- width = { 256 }
110
- height = { 320 }
111
- className = "object-cover w-full h-full"
112
- / >
99
+ >
100
+ < div className = "container mx-auto px-6 flex flex-col items-center" >
101
+ < h2 className = "text-center text-4xl font-bold mb-10" > ABOUT </ h2 >
102
+ < div className = "container mx-auto px-6 flex flex-col md:flex-row items-center" >
103
+ { /* Image Section */ }
104
+ < div
105
+ className = "w-full md:w-1/3 flex justify-center md:justify-start hover:scale-101 transition-transform duration-300"
106
+ ref = { leftRef }
107
+ >
108
+ < div className = "w-64 h-80 rounded-lg overflow-hidden border-4 border-primary shadow-lg" >
109
+ < Image
110
+ src = "/pics/pic2.jpg"
111
+ alt = "Dushan "
112
+ width = { 256 }
113
+ height = { 320 }
114
+ className = "object-cover w-full h-full"
115
+ />
116
+ </ div >
113
117
</ div >
114
- </ div >
115
118
116
- { /* Text Section */ }
117
- < div className = "w-full md:w-2/3 text-center md:text-left mt-10 mb-10 md:mt-0 md:ml-10 " ref = { rightRef } >
118
- < p className = "text-3xl font-semibold mt-4" > Hey</ p >
119
- < p className = "text-xl mt-2" >
120
- there! I'm a < span className = "text-primary" > Software Engineering</ span > undergraduate who loves coding, creativity, and problem-solving.
121
- When I'm not immersed in tech, you'll find me enjoying < span className = "text-primary" > music</ span > —either listening to my favorite songs or playing the < span className = "text-primary" > guitar</ span > .
122
-
123
- </ p >
124
- < p className = "text-xl mt-4" >
125
- I have a thing for the color < span className = "text-blue-400" > Blue</ span > (calm and cool, just like my approach to life!). Always < span className = "text-primary" > curious</ span > and eager to learn, I'm passionate about turning ideas into meaningful digital experiences.
126
-
127
- </ p >
128
- < p className = "text-xl mt-4" >
129
- Let's build something awesome together! 😊
130
-
131
- </ p >
119
+ { /* Text Section */ }
120
+ < div
121
+ className = "w-full md:w-2/3 text-center md:text-left mt-10 mb-10 md:mt-0 md:ml-10 "
122
+ ref = { rightRef }
123
+ >
124
+ < p className = "text-3xl font-semibold mt-4" > Hey</ p >
125
+ < p className = "text-xl mt-2" >
126
+ there! I'm a{ " " }
127
+ < span className = "text-primary" > Software Engineering</ span > { " " }
128
+ undergraduate who loves coding, creativity, and problem-solving.
129
+ When I'm not immersed in tech, you'll find me enjoying{ " " }
130
+ < span className = "text-primary" > music</ span > —either listening to
131
+ my favorite songs or playing the{ " " }
132
+ < span className = "text-primary" > guitar</ span > .
133
+ </ p >
134
+ < p className = "text-xl mt-4" >
135
+ I have a thing for the color{ " " }
136
+ < span className = "text-blue-400" > Blue</ span > (calm and cool, just
137
+ like my approach to life!). Always{ " " }
138
+ < span className = "text-primary" > curious</ span > and eager to learn,
139
+ I'm passionate about turning ideas into meaningful digital
140
+ experiences.
141
+ </ p >
142
+ < p className = "text-xl mt-4" >
143
+ Let's build something awesome together! 😊
144
+ </ p >
145
+ </ div >
132
146
</ div >
133
147
</ div >
134
- </ div >
135
148
</ section >
136
149
) ;
137
150
}
0 commit comments