Skip to content

Commit 52c8158

Browse files
committed
better about chevron behavior
1 parent 75eb36a commit 52c8158

File tree

1 file changed

+34
-12
lines changed

1 file changed

+34
-12
lines changed

src/components/home/sections/About.tsx

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import images from "@/images";
1212
const About: React.FC = () => {
1313
const animatedSection = useRef<HTMLDivElement>(null);
1414
const parallaxBackground = useRef<HTMLDivElement>(null);
15+
const scrollChevronContainer = useRef<HTMLDivElement>(null);
1516

1617
useGSAP(() => {
1718
gsap.registerPlugin(ScrollTrigger);
@@ -29,8 +30,33 @@ const About: React.FC = () => {
2930
},
3031
});
3132

32-
// Fade in content
33-
gsap.fromTo(
33+
const timeline = gsap.timeline({
34+
scrollTrigger: {
35+
trigger: animatedSection.current,
36+
start: "top top",
37+
end: "bottom top",
38+
scrub: true,
39+
pin: true,
40+
},
41+
});
42+
43+
timeline.fromTo(
44+
scrollChevronContainer.current,
45+
{
46+
position: "absolute",
47+
top: "5%",
48+
fontSize: "1.5rem",
49+
},
50+
{
51+
position: "absolute",
52+
top: "70%",
53+
fontSize: "1.25rem",
54+
duration: 1.5,
55+
ease: "power1.out",
56+
}
57+
);
58+
59+
timeline.fromTo(
3460
animatedContent,
3561
{
3662
opacity: 0,
@@ -39,13 +65,6 @@ const About: React.FC = () => {
3965
{
4066
opacity: 1,
4167
y: 0,
42-
scrollTrigger: {
43-
trigger: animatedSection.current,
44-
start: "top top",
45-
end: "bottom top",
46-
scrub: true,
47-
pin: true,
48-
},
4968
stagger: 0.3,
5069
duration: 1,
5170
}
@@ -77,6 +96,12 @@ const About: React.FC = () => {
7796
<div className="absolute inset-0 bg-black opacity-20 dark:opacity-50" />
7897

7998
{/* Foreground Content */}
99+
<div ref={scrollChevronContainer} className="relative z-10">
100+
<div className="text-center mt-6 animate-bounce">
101+
<FontAwesomeIcon icon={faChevronDown} className="fa-2x" />
102+
</div>
103+
</div>
104+
80105
<div className="relative z-10">
81106
<div id="about" className="max-w-xl text-white">
82107
<h2 className="animated-content text-4xl md:text-5xl lg:text-6xl mr-20 font-bold">
@@ -98,9 +123,6 @@ const About: React.FC = () => {
98123
<span className="font-semibold">CAD &amp; 3D Printing</span>, and{" "}
99124
<span className="font-semibold">homelab projects</span>.
100125
</p>
101-
<div className="animated-content text-center mt-6 animate-bounce">
102-
<FontAwesomeIcon icon={faChevronDown} className="fa-2x" />
103-
</div>
104126
</div>
105127
</div>
106128
</Section>

0 commit comments

Comments
 (0)