-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.js
32 lines (29 loc) · 822 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
28
29
30
31
32
const download = document.querySelector('#download');
const headerLogo = document.querySelector('#header-logo');
let deg = 0;
let cw;
let countRot;
download.addEventListener('click', () => {
countRot = 0;
countRot += 1;
deg += 70;
cw = true;
headerLogo.style.transitionDuration = '1s';
headerLogo.style.transform = `rotate(${deg}deg)`;
});
headerLogo.addEventListener('transitionend', () => {
if (cw && countRot < 3) {
countRot += 1;
deg -= 15;
console.log({ countRot, deg });
headerLogo.style.transitionDuration = '0.5s';
headerLogo.style.transform = `rotate(${deg}deg)`;
cw = false;
} else if (!cw && countRot < 3) {
countRot += 1;
deg += 5;
headerLogo.style.transitionDuration = '0.5s';
headerLogo.style.transform = `rotate(${deg}deg)`;
cw = true;
}
});