-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
503 lines (428 loc) · 14.2 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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
function loco(){
gsap.registerPlugin(ScrollTrigger);
// Using Locomotive Scroll from Locomotive https://github.com/locomotivemtl/locomotive-scroll
const locoScroll = new LocomotiveScroll({
el: document.querySelector("#main"),
smooth: true
});
// each time Locomotive Scroll updates, tell ScrollTrigger to update too (sync positioning)
locoScroll.on("scroll", ScrollTrigger.update);
// tell ScrollTrigger to use these proxy methods for the "#main" element since Locomotive Scroll is hijacking things
ScrollTrigger.scrollerProxy("#main", {
scrollTop(value) {
return arguments.length ? locoScroll.scrollTo(value, 0, 0) : locoScroll.scroll.instance.scroll.y;
}, // we don't have to define a scrollLeft because we're only scrolling vertically.
getBoundingClientRect() {
return {top: 0, left: 0, width: window.innerWidth, height: window.innerHeight};
},
// LocomotiveScroll handles things completely differently on mobile devices - it doesn't even transform the container at all! So to get the correct behavior and avoid jitters, we should pin things with position: fixed on mobile. We sense it by checking to see if there's a transform applied to the container (the LocomotiveScroll-controlled element).
pinType: document.querySelector("#main").style.transform ? "transform" : "fixed"
});
// each time the window updates, we should refresh ScrollTrigger and then update LocomotiveScroll.
ScrollTrigger.addEventListener("refresh", () => locoScroll.update());
// after everything is set up, refresh() ScrollTrigger and update LocomotiveScroll because padding may have been added for pinning, etc.
ScrollTrigger.refresh();
}
loco()
var hero = gsap.timeline()
hero.to(".hero",{
scale:1,
delay:1.8,
borderRadius:"0px",
},"a")
hero.to(".herobg",{
scale:1.1,
delay:1.82,
borderRadius:"0px",
},"a")
gsap.from(".js-navigation-logo",{
y: "-40px",
delay:1,
opacity:0,
})
gsap.from(".menu",{
y: "-40px",
delay:2.2,
opacity:0,
})
gsap.from(".sidebtn",{
y: "-40px",
opacity:0,
delay:2.4,
})
function split(){
var clutter = ''
document.querySelector(".grow").textContent.split("").forEach(function(char){
clutter += `<span>${char}</span>`
})
document.querySelector(".grow").innerHTML = clutter
}
split()
//
gsap.to(".grow span",{
scrollTrigger:{
scrub: 3,
trigger: `.grow span`,
// set start end according to preference
start: `top 70%`,
end: `100% 0%`,
scroller: `#main`,
},
stagger:0.26,
color:"#e3e3c4",
})
gsap.to(".u-icon--separator-main ",{
scrollTrigger:{
scrub: 2,
trigger: `.wrap > .elm2`,
// set start end according to preference
start: `0% 90%`,
end: `100% 0%`,
scroller: `#main`,
},
stagger:0.26,
x:"100px",
},"sath")
gsap.to(".u-icon--separator-secondary ",{
scrollTrigger:{
scrub: 2,
trigger: `.wrap > .elm2`,
// set start end according to preference
start: `0% 90%`,
end: `100% 0%`,
scroller: `#main`,
},
stagger:0.26,
x:"-500px",
},"sath")
//
function splitTwo(){
var clutterTwo = ''
document.querySelector(".grow2").textContent.split("").forEach(function(char){
clutterTwo += `<span>${char}</span>`
})
document.querySelector(".grow2").innerHTML = clutterTwo
}
splitTwo()
gsap.to(".grow2 span",{
scrollTrigger:{
scrub: 3,
trigger: `.grow2 span`,
// set start end according to preference
start: `-50% 90%`,
end: `100% 50%`,
scroller: `#main`,
},
stagger:0.26,
color:"#434b34",
})
function splitThree(){
var clutter = ''
document.querySelector(".grow3").textContent.split("").forEach(function(char){
clutter += `<span>${char}</span>`
})
document.querySelector(".grow3").innerHTML = clutter
}
splitThree()
gsap.to(".grow3 span",{
scrollTrigger:{
scrub: 3,
trigger: `.grow3 span`,
// set start end according to preference
start: `-50% 90%`,
end: `100% 50%`,
scroller: `#main`,
},
stagger:0.26,
color:"#e3e3c4",
})
//
function splitFour(){
var clutter = ''
document.querySelector(".grow4").textContent.split("").forEach(function(char){
clutter += `<span>${char}</span>`
})
document.querySelector(".grow4").innerHTML = clutter
}
splitFour()
gsap.to(".grow4 span",{
scrollTrigger:{
scrub: 3,
trigger: `.grow4 span`,
// set start end according to preference
start: `-50% 90%`,
end: `100% 50%`,
scroller: `#main`,
},
stagger:0.26,
color:"#434b34",
})
// svg
gsap.to(".page5svg ",{
scrollTrigger:{
scrub: 2,
trigger: `#page_5 > .page5elm1`,
// set start end according to preference
start: `0% 90%`,
end: `100% 0%`,
scroller: `#main`,
},
x:"-200px",
})
gsap.to(".page5svg3 ",{
scrollTrigger:{
scrub: 2,
trigger: `#page_5 > .page5elm2`,
// set start end according to preference
start: `0% 90%`,
end: `100% 20%`,
scroller: `#main`,
},
x:"-200px",
})
//Page 1 animation
gsap.to(".logo ",{
scrollTrigger:{
scrub: 2,
trigger: `.nav`,
// set start end according to preference
start: `0% 0%`,
pin:true,
end: `300% 0%`,
scroller: `#main`,
},
transform: "translate(-30%, 0%)",
scale:1,
})
gsap.to(".hero ",{
scrollTrigger:{
scrub: 2,
trigger: `#page_1`,
// set start end according to preference
start: `100% 50%`,
end: `100% 50%`,
scroller: `#main`,
},
opacity:"0.6",
})
//page2 timeline
var page2 = gsap.timeline({
scrollTrigger:{
trigger:`#page_3`,
scrub: 2,
start: `20% 80%`,
end: `60% 80%`,
scroller: `#main`,
}
})
page2.from(".wrap1 p",{
opacity:"0",
y:"30px",
},"a")
page2.from(".elem2 .wrap2 .page3img2",{
opacity:"0",
y:"30px",
},"a")
page2.from(".page3btn",{
opacity:"0",
y:"30px",
})
page2.from(".page3img1",{
opacity:"0",
y:"30px",
})
page2.from(".page3img3",{
opacity:"0",
y:"30px",
})
//
var page5 = gsap.timeline({
scrollTrigger:{
trigger:`.page_center`,
scrub: 2,
start: `0% 95%`,
end: `65% 85%`,
scroller: `#main`,
}
})
page5.from(".page5box1",{
opacity:"0",
y:"30px",
},"a")
page5.from(".page5box3",{
opacity:"0",
y:"30px",
},"a")
page5.from(".page5box2",{
opacity:"0",
y:"30px",
})
// page6
var page6 = gsap.timeline({
scrollTrigger:{
trigger:`.page_6centr`,
scrub: 2,
start: `-20% 100%`,
end: `60% 80%`,
scroller: `#main`,
}
})
page6.from(".page6one",{
x:"50%",
},"a")
page6.from(".page6three",{
x:"-50%",
},"a")
page6.from(".page6otwo",{
opacity:"0",
y:"60px",
})
page6.from(".page6explore",{
opacity:"0",
y:"60px",
})
// page4
const box = document.querySelector(".hover1");
const explore1 = document.querySelector(".hoverbtn1");
const exploretxt1 = document.querySelector(".exploretxt1");
const exploresvg1 = document.querySelector("#exploresvg1");
const imgbox = document.querySelector(".hover1 .img");
const page4Content = document.querySelector(".content1");
const page4Text = document.querySelector(".content1 h3");
const page4PText = document.querySelector(".content1 p");
box.addEventListener("mouseenter",function(){
imgbox.style.left = "0%"
box.style.backgroundColor = "#434b34"
page4Content.style.paddingLeft= "28%"
page4Text.style.color = "#e3e3c4"
page4PText.style.color = "#e3e3c4"
explore1.style.backgroundColor ="#e3e3c4"
exploretxt1.style.display = "none"
exploresvg1.style.display = "block"
})
box.addEventListener("mouseleave",function(){
box.style.backgroundColor = "#F7F7EE"
imgbox.style.left = "-25%"
page4Content.style.paddingLeft= "5%"
page4Text.style.color = "#434b34"
page4PText.style.color = "#434b34"
explore1.style.backgroundColor ="#5b6647"
exploretxt1.style.display = "block"
exploresvg1.style.display = "none"
})
//
const box2 = document.querySelector(".hover2");
const explore2 = document.querySelector(".hoverbtn2");
const exploretxt2 = document.querySelector(".exploretxt2");
const exploresvg2 = document.querySelector("#exploresvg2");
const imgbox2 = document.querySelector(".hover2 .img");
const page4Content2 = document.querySelector(".content2");
const page4Text2 = document.querySelector(".content2 h3");
const page4PText2 = document.querySelector(".content2 p");
box2.addEventListener("mouseenter",function(){
imgbox2.style.left = "0%"
box2.style.backgroundColor = "#434b34"
page4Content2.style.paddingLeft= "28%"
page4Text2.style.color = "#e3e3c4"
page4PText2.style.color = "#e3e3c4"
explore2.style.backgroundColor ="#e3e3c4"
exploretxt2.style.display = "none"
exploresvg2.style.display = "block"
})
box2.addEventListener("mouseleave",function(){
box2.style.backgroundColor = "#F7F7EE"
imgbox2.style.left = "-25%"
page4Content2.style.paddingLeft= "5%"
page4Text2.style.color = "#434b34"
page4PText2.style.color = "#434b34"
explore2.style.backgroundColor ="#5b6647"
exploretxt2.style.display = "block"
exploresvg2.style.display = "none"
})
//
const box3 = document.querySelector(".hover3");
const explore3 = document.querySelector(".hoverbtn3");
const exploretxt3 = document.querySelector(".exploretxt3");
const exploresvg3 = document.querySelector("#exploresvg3");
const imgbox3 = document.querySelector(".hover3 .img");
const page4Content3 = document.querySelector(".content3");
const page4Text3 = document.querySelector(".content3 h3");
const page4PText3 = document.querySelector(".content3 p");
box3.addEventListener("mouseenter",function(){
imgbox3.style.left = "0%"
box3.style.backgroundColor = "#434b34"
page4Content3.style.paddingLeft= "28%"
page4Text3.style.color = "#e3e3c4"
page4PText3.style.color = "#e3e3c4"
explore3.style.backgroundColor ="#e3e3c4"
exploretxt3.style.display = "none"
exploresvg3.style.display = "block"
})
box3.addEventListener("mouseleave",function(){
box3.style.backgroundColor = "#F7F7EE"
imgbox3.style.left = "-25%"
page4Content3.style.paddingLeft= "5%"
page4Text3.style.color = "#434b34"
page4PText3.style.color = "#434b34"
explore3.style.backgroundColor ="#5b6647"
exploretxt3.style.display = "block"
exploresvg3.style.display = "none"
})
//
const box4 = document.querySelector(".hover4");
const explore4 = document.querySelector(".hoverbtn4");
const exploretxt4 = document.querySelector(".exploretxt4");
const exploresvg4 = document.querySelector("#exploresvg4");
const imgbox4 = document.querySelector(".hover4 .img");
const page4Content4 = document.querySelector(".content4");
const page4Text4 = document.querySelector(".content4 h3");
const page4PText4 = document.querySelector(".content4 p");
box4.addEventListener("mouseenter",function(){
imgbox4.style.left = "0%"
box4.style.backgroundColor = "#434b34"
page4Content4.style.paddingLeft= "28%"
page4Text4.style.color = "#e3e3c4"
page4PText4.style.color = "#e3e3c4"
explore4.style.backgroundColor ="#e3e3c4"
exploretxt4.style.display = "none"
exploresvg4.style.display = "block"
})
box4.addEventListener("mouseleave",function(){
box4.style.backgroundColor = "#F7F7EE"
imgbox4.style.left = "-25%"
page4Content4.style.paddingLeft= "5%"
page4Text4.style.color = "#434b34"
page4PText4.style.color = "#434b34"
explore4.style.backgroundColor ="#5b6647"
exploretxt4.style.display = "block"
exploresvg4.style.display = "none"
})
//
const box5 = document.querySelector(".hover5");
const explore5 = document.querySelector(".hoverbtn5");
const exploretxt5 = document.querySelector(".exploretxt5");
const exploresvg5 = document.querySelector("#exploresvg5");
const imgbox5 = document.querySelector(".hover5 .img");
const page4Content5 = document.querySelector(".content5");
const page4Text5 = document.querySelector(".content5 h3");
const page4PText5 = document.querySelector(".content5 p");
box5.addEventListener("mouseenter",function(){
imgbox5.style.left = "0%"
box5.style.backgroundColor = "#434b34"
page4Content5.style.paddingLeft= "28%"
page4Text5.style.color = "#e3e3c4"
page4PText5.style.color = "#e3e3c4"
explore5.style.backgroundColor ="#e3e3c4"
exploretxt5.style.display = "none"
exploresvg5.style.display = "block"
})
box5.addEventListener("mouseleave",function(){
box5.style.backgroundColor = "#F7F7EE"
imgbox5.style.left = "-25%"
page4Content5.style.paddingLeft= "5%"
page4Text5.style.color = "#434b34"
page4PText5.style.color = "#434b34"
explore5.style.backgroundColor ="#5b6647"
exploretxt5.style.display = "block"
exploresvg5.style.display = "none"
})