-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscript.js
More file actions
129 lines (123 loc) · 3.02 KB
/
script.js
File metadata and controls
129 lines (123 loc) · 3.02 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
function HomePageanimation () {
gsap.set('.slidesm',{
scale : 5
})
var tl = gsap.timeline({
scrollTrigger : {
trigger : ".home",
start : "top top",
end : "bottom bottom",
scrub : 2
},
})
tl.to('.video',{
'--clip' : "0%",
ease : Power2,
},'a')
tl.to('.slidesm',{
scale : 1,
ease : Power2,
},'a')
tl.to('.lft',{
xPercent : -10,
stagger : .03,
ease : Power4,
},'b')
tl.to('.rgt',{
xPercent : 10,
stagger : .03,
ease : Power4,
},'b')
}
function realPartAnimation() {
gsap.to(".slide",{
scrollTrigger : {
trigger : ".real",
start : "top top",
end : "bottom bottom",
scrub : 1
},
xPercent : -200,
ease :Power4
});
}
function teamPageAnimation() {
document.querySelectorAll(".listitem").forEach(function(el){
el.addEventListener("mousemove", function(dets) {
gsap.to(this.querySelector(".picture"),{
opacity : 1,
x : gsap.utils.mapRange(0, window.innerWidth,-200,200, dets.clientX),
ease : Power4,
duration : .5
})
})
el.addEventListener("mouseleave", function(dets) {
gsap.to(this.querySelector(".picture"),{
opacity : 0,
ease : Power4,
duration : .5
})
})
})
}
function aboutPageAnimation(){
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 : 0
})
gsap.to(".textpara span",{
scrollTrigger : {
trigger : ".para",
start : "top 60%",
end : "bottom 90%",
scrub : .2,
},
opacity : 1,
stagger : .03,
ease : Power4
})
}
function locomotive() {
(function () {
const locomotiveScroll = new LocomotiveScroll();
})();
}
function capsuleAnimation() {
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)
}
})
})
}
locomotive();
aboutPageAnimation();
realPartAnimation();
HomePageanimation();
teamPageAnimation();
capsuleAnimation();
BodyColorChange();