-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
180 lines (172 loc) · 3.32 KB
/
script.js
File metadata and controls
180 lines (172 loc) · 3.32 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
function cursor(){
gsap.set(".ball", {xPercent: -50, yPercent: -50});
let xTo = gsap.quickTo(".ball", "x", {duration: 0.6, ease: "power3"}),
yTo = gsap.quickTo(".ball", "y", {duration: 0.6, ease: "power3"});
window.addEventListener("mousemove", e => {
xTo(e.clientX);
yTo(e.clientY);
})
}
function page1animation(){
var tl = gsap.timeline()
tl.from("nav h1, nav h4, nav button",{
y:-60,
opacity:0,
delay:1,
duration:0.3,
stagger:0.15
})
tl.from(".ceter-part1 h1",{
x:-900,
opacity:0,
duration:1
})
tl.from(".ceter-part1 p",{
x:-900,
opacity:0,
duration:0.4
})
tl.from(".ceter-part1 button",{
x: -200,
opacity:0,
duration:0.5,
})
tl.from(".ceter-part2 img",{
opacity:0,
duration:0.6,
},"-=0.4")
tl.from(".sectionbottom",{
opacity:0,
y:40,
stagger:0.15,
duration:0.7,
})
}
function page2animation(){
var tl2 = gsap.timeline({
scrollTrigger:{
trigger:".section2",
scroller:"body",
start:"top 45%",
end:"top 0",
scrub:2,
}
})
tl2.from(".services",{
x:-950,
opacity:0,
duration:0.5
})
tl2.from(".elem.line1.left",{
x:-700,
opacity:0,
duration:0.8,
},"affu")
tl2.from(".elem.line1.right",{
x:700,
opacity:0,
duration:0.8
},"affu")
tl2.from(".elem.line2.left",{
x:-700,
opacity:0,
duration:0.8,
},"sonu")
tl2.from(".elem.line2.right",{
x:700,
opacity:0,
duration:0.8
},"sonu")
}
function page3animation(){
var tl3 = gsap.timeline({
scrollTrigger:{
trigger: ".section3",
start: "top 45%",
// markers:true,
// start:"top 20%",
end: "top 0%",
scrub:2,
},
})
tl3.from(".lets",{
x:-900,
opacity:0,
duration:0.1,
scrub:2,
stagger:0.15
},"sonu")
tl3.from(".btn",{
x:-900,
duration:0.7,
opacity:0,
scrub:2,
stagger:0.15
},"sonu")
tl3.from(".paras",{
x:-500,
scrub:2,
// stagger:0.1
},"sonu")
tl3.from(".pp",{
y:500,
opacity:0,
duration:0.4,
delay:0.5,
scrub:2,
stagger:0.15
},"sonu")
}
function page4animation(){
var tl4 = gsap.timeline({
scrollTrigger:{
trigger: "section4",
start:"top 65%",
end: "top 100%",
// scrub: 1,
// markers:true,
},
})
// tl4.from(".lastss",{
// x:500,
// opacity:0,
// stagger:0.15
// })
tl4.from(".lastss",{
x:-2000,
opacity:0,
duration:1.5,
delay:1,
scrub:2,
stagger:0.15,
},"sonu")
tl4.from(".p1",{
x:-500,
ease:"power1.inOut",
duration:1.5,
delay:0.5,
scrub:2,
stagger:0.15
},"sonu")
tl4.from(".p2",{
y:200,
ease:"power1.inOut",
duration:1.5,
delay:0.5,
scrub:2,
stagger:0.15
},"sonu")
tl4.from(".p3",{
x:500,
ease:"power1.inOut",
duration:1.5,
delay:0.5,
scrub:2,
stagger:0.15
},"sonu")
}
cursor()
page1animation()
page2animation()
page3animation()
page4animation()