-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
73 lines (64 loc) · 1.39 KB
/
main.js
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
function toggleOverlay() {
var overlay = document.querySelector("body");
var swiper = document.querySelector(".swiper");
overlay.classList.toggle('hide-overlay');
if (overlay.classList.contains('hide-overlay')) {
// When hide-overlay is added
swiper.style.opacity = "1";
swiper.style.zIndex = "1";
} else {
// When hide-overlay is removed
swiper.style.opacity = "0";
setTimeout(() => {
swiper.style.zIndex = "-1";
// Trigger copy animation when hide-overlay is removed
triggerCopyAnimation();
}, 1000); // Delay of 1 second
}
}
gsap.set(".copy span", {
y: 350,
})
gsap.set(".logo, .button", {
y: -50,
});
gsap.timeline()
.to(".logo, .button", {
y:0,
delay: 1,
stagger: -0.1,
});
function triggerCopyAnimation() {
gsap.timeline()
.to(".copy span", {
y: 0,
duration: 1.5,
ease: 'expo.out',
stagger: 0.09,
});
}
document.addEventListener('DOMContentLoaded', () => {
const swiper = new Swiper('.swiper', {
loop: true,
autoplay: true,
effect: 'fade',
speed: 800,
autoplay: {
delay: 2800,
disableOnInteraction: false,
},
fadeEffect: {
crossFade: true,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
gsap.timeline()
.from("body", {
opacity: 0,
duration: 1.6,
delay: 0.5,
});
});