-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
27 lines (24 loc) · 808 Bytes
/
app.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
const intro = document.querySelector('.intro');
const video = intro.querySelector('video');
const text = intro.querySelector('h1');
const section = document.querySelector('section');
const end = section.querySelector('h1');
const controller = new ScrollMagic.Controller();
let scene = new ScrollMagic.Scene({
duration: 4000,
triggerElement: intro,
triggerHook: 0
}).addIndicators().setPin(intro).addTo(controller);
const textAnimation = TweenMax.fromTo(text, 3, { opacity: 1 }, { opacity: 0 });
let scene2 = new ScrollMagic.Scene({
duartion: 1000,
triggerElement: intro,
triggerHook: 0
}).setTween(textAnimation).addTo(controller);
let scrollPos = 0;
scene.on('update', e => {
scrollPos = e.scrollPos / 1000;
})
setInterval(() => {
video.currentTime = scrollPos;
}, 33.3);