-
Notifications
You must be signed in to change notification settings - Fork 0
/
clock.js
31 lines (25 loc) · 901 Bytes
/
clock.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
/*var inc = 1000;
clock();
function clock() {
const date = new Date();
const hours = ((date.getHours() + 11) % 12 + 1);
const minutes = date.getMinutes();
const seconds = date.getSeconds();
const hour = hours * 30;
const minute = minutes * 6;
const second = seconds * 6;
document.querySelector('.hour').style.transform = `rotate(${hour}deg)`
document.querySelector('.minute').style.transform = `rotate(${minute}deg)`
document.querySelector('.second').style.transform = `rotate(${second}deg)`
}
setInterval(clock, inc);
<div class="clock">
<div class="wrap">
<span class="hour"></span>
<span class="minute"></span>
<span class="second"></span>
<span class="dot"></span>
</div>
</div>
<link rel="stylesheet" href="clock.css">
<script src="clock.js"></script>*/