-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
117 lines (106 loc) · 2.29 KB
/
script.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
function homepageAnimation(){
gsap.set(".slidesm", {scale: 3})
var t1 = gsap.timeline({
scrollTrigger:{
trigger:".home",
start:"top top",
end:"bottom bottom",
scrub:3
}
})
t1.to(".video-div",{
'--clip':"0%",
ease: Power2,
},'a')
.to(".slidesm",{
scale: 1,
ease: Power2
},'a')
.to(".slidesm",{
scale: 1,
ease: Power2
},'a')
.to(".lft",{
xPercent: -10,
stagger: .03,
ease: Power4
},'b')
.to(".rgt",{
xPercent: 10,
stagger: .03,
ease: Power4
},'b')
}
function realPageAnimation(){
gsap.to(".slide", {
scrollTrigger: {
trigger:".real",
start:"top top",
end:"bottom bottom",
scrub: 1
},
xPercent: -200,
ease: Power2
})
}
function paraAnimation(){
var clutter = ""
document.querySelector(".textpara")
.textContent.split("")
.forEach(function(e){
if(e === " ") clutter += `<span> </span>`
clutter += `<span>${e}</span>`
})
document.querySelector(".textpara").innerHTML = clutter;
gsap.set(".textpara span", {opacity: .1})
gsap.to(".textpara span", {
scrollTrigger:{
trigger:".para",
start:"top 60%",
end:"bottom 90%",
scrub:0.2,
},
opacity: 1,
stagger: .03,
ease: Power4,
})
}
function loco(){
(function () {
const locomotiveScroll = new LocomotiveScroll();
})();
}
function capsulesAnimation(){
gsap.to(".capsule:nth-child(2)",{
scrollTrigger: {
trigger:".capsules",
start:"top 70%",
end:"bottom bottom",
scrub: 1
},
y: 0,
ease: Power4
})
}
function bodyColorChange(){
document.querySelectorAll(".section")
.forEach(function(e){
ScrollTrigger.create({
trigger:e,
start:"top 50%",
end:"bottom 50%",
onEnter:function(){
document.body.setAttribute("theme",e.dataset.color);
},
onEnterBack: function(){
document.body.setAttribute("theme", e.dataset.color)
},
})
})
}
loco();
paraAnimation();
realPageAnimation();
homepageAnimation();
capsulesAnimation();
bodyColorChange();