-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
42 lines (33 loc) · 1.1 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
const iammenasco = document.querySelector('.iammenasco');
const i = document.querySelector('.i');
const am = document.querySelector('.am');
const menasco = document.querySelector('.menasco');
const links = document.querySelector('.links');
const auroral = document.getElementById('auroral');
const aurorals = [
'agrabah',
'northern',
'northern-intense',
'northern-dimmed',
'northern-dusk',
'northern-warm'
];
const randomAuroral = () => {
const colorScheme = aurorals[Math.floor(Math.random() * aurorals.length)];
auroral.className = `auroral-${colorScheme}`;
};
const rerunAnimation = () => {
i.classList.remove('i-animate');
am.classList.remove('am-animate');
menasco.classList.remove('menasco-animate');
links.classList.remove('menasco-animate');
const trick = iammenasco.offsetWidth;
i.classList.add('i-animate');
am.classList.add('am-animate');
menasco.classList.add('menasco-animate');
links.classList.add('menasco-animate');
randomAuroral();
return trick;
};
iammenasco.addEventListener('click', rerunAnimation);
document.addEventListener('DOMContentLoaded', randomAuroral);