-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
61 lines (51 loc) · 1.73 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
<title>Nixcon animation</title>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', () => {
const minuteElem = document.getElementById('minute')
const hourElem = document.getElementById('hour')
function rotateElem(elem, clock, offset) {
if (offset === undefined) {
offset = 0
}
let deg = (360/60) * (clock - offset)
console.log(deg)
elem.style = 'transform: rotate(' + deg + 'deg)';
}
let lastMinute
let lastHour
setInterval(() => {
const d = new Date()
const minute = d.getUTCMinutes()
const hour = d.getUTCHours() + 1 // London is UTC+1
if (minute != lastMinute) {
rotateElem(minuteElem, minute)
lastMinute = minute
}
if (hour != lastHour) {
rotateElem(hourElem, hour, 20.85)
lastHour = hour
}
}, 110)
}, false)
</script>
<style>
img {
position: absolute;
left: 0;
top: 0;
float: left;
}
img {
transition: all 0.1s ease-in-out;
}
</style>
</head>
<body>
<!-- <img id="logo" height="200" src="./nixcon2018-nohands.svg" /> -->
<img id="hour" height="200" src="./nixcon2018-separate-hand-hour.svg" />
<img id="minute" height="200" src="./nixcon2018-separate-hand-minute.svg" />
</body>
</html>