-
Notifications
You must be signed in to change notification settings - Fork 0
/
blinker.html
80 lines (73 loc) · 1.72 KB
/
blinker.html
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Blinker</title>
</head>
<style>
* {
margin: 0;
padding: 0;
}
.wrapper {
width: 100vw;
height: 100vh;
background-color: #0d0121;
display: flex;
justify-content: center;
align-items: center;
}
.blinkers {
margin: 10px;
width: 70px;
height: 70px;
border-radius: 20px;
background-color: white;
}
.on {
background-color: #f08902;
}
</style>
<body>
<div class="wrapper">
<div class="blinkers" id="b0"></div>
<div class="blinkers" id="b1"></div>
<div class="blinkers" id="b2"></div>
<div class="blinkers" id="b3"></div>
<div class="blinkers" id="b4"></div>
<div class="blinkers" id="b5"></div>
</div>
<script>
let blinkers = [];
for (let i = 0; i <= 5; i++) {
blinkers[i] = document.getElementById("b" + i);
}
function blink() {
setTimeout(() => {
blinkers[0].classList.toggle("on");
}, 100);
setTimeout(() => {
blinkers[1].classList.toggle("on");
}, 200);
setTimeout(() => {
blinkers[2].classList.toggle("on");
}, 300);
setTimeout(() => {
blinkers[3].classList.toggle("on");
}, 400);
setTimeout(() => {
blinkers[4].classList.toggle("on");
}, 400);
setTimeout(() => {
blinkers[5].classList.toggle("on");
}, 500);
setTimeout(() => {
blinkers.forEach((e) => {
e.classList.toggle("on");
});
}, 700);
}
setInterval(blink, 1000);
</script>
</body>
</html>