-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathintro.js
42 lines (33 loc) · 1015 Bytes
/
intro.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
import {
TweenLite
} from 'gsap';
import Home from './public/scripts/pages/home';
(async() => {
const logoAnimation = () => new Promise(resolve => {
const logoContainer = document.querySelector(`.logo-container`);
const logo = document.querySelector(`.logo`);
logo.addEventListener(`animationend`, ({ animationName }) => {
if (animationName === `hideLogo`) {
logoContainer.style.display = `none`;
logo.classList.add(`hidden`);
logo.classList.remove(`intro`, `hide`, `show`);
resolve();
}
});
logo.classList.add(`hide`);
});
const dependencies = () => Promise.all([
document.fonts.ready,
new Promise(resolve => {
setTimeout(resolve, 1000)
})
]);
await dependencies();
await logoAnimation();
const page = window.location.pathname;
switch (page) {
case `/`: {
Home();
}
}
})();