-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordReveal.js
More file actions
32 lines (28 loc) · 870 Bytes
/
Copy pathwordReveal.js
File metadata and controls
32 lines (28 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
document.addEventListener('DOMContentLoaded', function() {
const checkGSAP = setInterval(() => {
if (typeof gsap !== 'undefined' && typeof ScrollTrigger !== 'undefined') {
clearInterval(checkGSAP);
initAnimation();
}
}, 100);
});
function initAnimation() {
const text = document.querySelector('.animate-text');
if (!text) return;
text.innerHTML = text.textContent.replace(/\S/g, "<span>$&</span>");
gsap.registerPlugin(ScrollTrigger);
gsap.to(".animate-text span", {
opacity: 1,
y: 0,
duration: 0.3,
stagger: 0.05,
ease: "power2.out",
scrollTrigger: {
trigger: ".text-container",
start: "top 80%",
end: "top 30%",
toggleActions: "play none none none",
markers: false
}
});
}