(null)
const rewindData = ref(null)
-// No animation refs needed for CSS-only animations
+gsap.registerPlugin(ScrollTrigger)
// Fetch rewind data
const fetchRewindData = async () => {
@@ -894,7 +896,45 @@ const fetchRewindData = async () => {
}
}
-onMounted(() => fetchRewindData())
+onMounted(async () => {
+ await fetchRewindData()
+
+ // Ensure DOM is updated before running GSAP
+ await nextTick()
+
+ if (rewindData.value) {
+ // Animate the header
+ gsap.from(".header", {
+ opacity: 0,
+ y: 30,
+ duration: 0.8,
+ ease: "power3.out"
+ })
+
+ // Animate sections on scroll
+ const sections = gsap.utils.toArray(".scroll-section")
+ sections.forEach((section) => {
+ gsap.from(section, {
+ opacity: 0,
+ y: 50,
+ duration: 0.8,
+ ease: "power3.out",
+ scrollTrigger: {
+ trigger: section,
+ start: "top 80%", // Animation starts when the top of the section is 80% from the top of the viewport
+ end: "bottom 20%",
+ toggleActions: "play none none none"
+ }
+ })
+ })
+ }
+})
+
+onBeforeUnmount(() => {
+ // Kill all ScrollTriggers to prevent memory leaks
+ ScrollTrigger.getAll().forEach((trigger) => trigger.kill())
+})
+
// Helper methods
@@ -1154,49 +1194,5 @@ definePageMeta({
diff --git a/package.json b/package.json
index feee428..dfbaec3 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,7 @@
"blurhash": "^2.0.5",
"cfturnstile-vue3": "^2.0.0",
"eslint": "^9.39.1",
+ "gsap": "^3.14.2",
"highlightjs": "^9.16.2",
"html2canvas": "^1.4.1",
"katex": "^0.16.25",