-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
37 lines (36 loc) · 1.06 KB
/
index.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
<html>
<head>
<title>Clock</title>
<link rel="stylesheet" type="text/css" href="clock.css">
</head>
<body>
<div class="outer">
<div class="middle">
<div id="clock" class="inner">
<div id="hour" class="hand">
</div>
<div id="minute" class="hand">
</div>
<div id="second" class="hand">
</div>
<!--<div id="center-circle">-->
<!--</div>-->
</div>
</div>
</div>
<script>
let secondHand = document.getElementById('second')
let minuteHand = document.getElementById('minute')
let hourHand = document.getElementById('hour')
setInterval(function () {
let now = new Date()
let degrees = now.getSeconds()*6-90
secondHand.style.transform = 'rotate('+degrees+'deg)'
degrees = now.getMinutes()*6-90
minuteHand.style.transform = 'rotate('+degrees+'deg)'
degrees = now.getHours()*30-90
hourHand.style.transform = 'rotate('+degrees+'deg)'
}, 1000)
</script>
</body>
</html>