Skip to content

Commit 2987c5e

Browse files
committed
fix: remove redundant GSAP class from ContactSection and update toggle actions for animations
1 parent da63cf8 commit 2987c5e

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/components/ContactSection.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<section id="contact" class="py-8 scroll-mt-20 gsap-section">
55
<h2 class="mb-12 text-center text-3xl text-grayblue-100 font-medium gsap-fade-up">Get in Touch</h2>
66
<div class="flex justify-center gsap-fade-up">
7-
<div class="tidycal-embed gsap-fade-up" data-path="jperusm/15-minute-meeting"></div>
7+
<div class="tidycal-embed" data-path="jperusm/15-minute-meeting"></div>
88
<script src="https://asset-tidycal.b-cdn.net/js/embed.js" async></script>
99
</div>
1010
</section>

src/components/HomeSection.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import socialNetworks from '@/assets/data/social-networks.json'
33
import { Image } from 'astro:assets'
44
import profilePicture from '@/assets/images/profile.png'
55
---
6-
<section id="home" class="py-8 scroll-mt-20 gsap-section"> <div class="flex flex-col items-center lg:flex-row lg:justify-between">
6+
<section id="home" class="py-8 scroll-mt-20"> <div class="flex flex-col items-center lg:flex-row lg:justify-between">
77
<div class="mb-8 text-center lg:mb-0 lg:text-left lg:w-1/2">
88
<h1 class="mb-4 text-5xl font-medium gsap-hero-stagger">Jonas Perusquia Morales</h1>
99
<h2 class="mb-6 text-2xl font-light text-blue-300 gsap-hero-stagger">Chief Technology Officer</h2>

src/scripts/gsap-animations.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ import { ScrollTrigger } from 'gsap/ScrollTrigger';
66
gsap.registerPlugin(ScrollTrigger);
77

88
export function initGSAPAnimations() {
9-
if (typeof window === 'undefined') return;
10-
// Animate elements with fade-up effect on scroll
9+
if (typeof window === 'undefined') return; // Animate elements with fade-up effect on scroll
1110
gsap.utils.toArray('.gsap-fade-up').forEach((element) => {
11+
// Check if the element is inside the contact section
12+
const isInsideContactSection = element.closest('#contact') !== null;
13+
const toggleActions = isInsideContactSection ? 'play none play none' : 'play reverse play reverse';
14+
1215
gsap.fromTo(element,
1316
{
1417
opacity: 0,
@@ -23,7 +26,7 @@ export function initGSAPAnimations() {
2326
trigger: element,
2427
start: 'top 80%',
2528
end: 'bottom 10%',
26-
toggleActions: 'play reverse play reverse'
29+
toggleActions: toggleActions
2730
}
2831
}
2932
);
@@ -44,9 +47,12 @@ export function initGSAPAnimations() {
4447
delay: index * 0.2
4548
}
4649
);
47-
});
48-
// Animate sections with a slight scale effect
50+
}); // Animate sections with a slight scale effect
4951
gsap.utils.toArray('.gsap-section').forEach((element) => {
52+
// Check if the element has id="contact" to avoid reversing animation
53+
const isContactSection = element.id === 'contact';
54+
const toggleActions = isContactSection ? 'play none play none' : 'play reverse play reverse';
55+
5056
gsap.fromTo(element,
5157
{
5258
opacity: 0,
@@ -61,7 +67,7 @@ export function initGSAPAnimations() {
6167
trigger: element,
6268
start: 'top 85%',
6369
end: 'bottom 15%',
64-
toggleActions: 'play reverse play reverse'
70+
toggleActions: toggleActions
6571
}
6672
}
6773
);

0 commit comments

Comments
 (0)