-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
56 lines (51 loc) · 1.37 KB
/
index.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
const controller = new ScrollMagic.Controller();
function vw(v) {
const w = Math.max(
document.documentElement.clientWidth,
window.innerWidth || 0,
);
return v * w / 100;
}
// Slide hands in when scrolling
const handsTimeline = new TimelineMax();
const leftHandTween = TweenMax.to('.hand-left', 1, { left: 0 });
const rightHandTween = TweenMax.to('.hand-right', 1, { right: 0 });
handsTimeline.add([leftHandTween, rightHandTween]);
const handsScene = new ScrollMagic.Scene({
triggerHook: 0,
duration: 600,
offset: 100,
reverse: true,
triggerElement: '.table',
})
.setTween(handsTimeline)
.addTo(controller);
// Scale the logo down when sticky
const logoTweenScene = new ScrollMagic.Scene({
triggerHook: 0,
duration: 150,
offset: vw(-5),
reverse: true,
triggerElement: '.table',
})
.setTween('.logo-container', 1, { scale: 0.6 })
.setTween('.logo-lower', 1, { opacity: 0 })
.addTo(controller);
// Expand batman to full width
// This is necessary for mobile, as the content
// width is wider than the batman element.
const lexLuther = new ScrollMagic.Scene({
triggerHook: 0,
offset: vw(-8),
reverse: true,
triggerElement: 'h1',
})
.setClassToggle('.batman', 'batman-fullwidth')
.addTo(controller);
const flkty = new Flickity('.main-carousel', {
cellAlign: 'left',
contain: true,
wrapAround: true,
autoPlay: true,
imagesLoaded: true,
});