-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
81 lines (79 loc) · 1.79 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
#clock {
width: 600px;
height: 600px;
background-image: url(img/b3c1ada6dd03483168181abc60f19708.jpg);
background-size: 100%;
position: relative;
}
#sec {
width: 4px;
height: 200px;
background-color: #f00;
position: absolute;
left: 300px;
bottom: 300px;
transform-origin: 50% bottom;
/*transform: rotate(30deg);*/
}
#min {
width: 8px;
height: 160px;
background-color: darkmagenta;
position: absolute;
left: 300px;
bottom: 300px;
transform-origin: 50% bottom;
/*transform: rotate(30deg);*/
}
#hour {
width: 12px;
height: 120px;
background-color: black;
position: absolute;
left: 300px;
bottom: 300px;
transform-origin: 50% bottom;
/*transform: rotate(30deg);*/
}
</style>
</head>
<body>
<div id="clock">
<div id="sec"></div>
<div id="min"></div>
<div id="hour"></div>
</div>
<script>
var oSec = document.getElementById("sec");
var oMin = document.getElementById("min");
var oHour = document.getElementById("hour");
function getNow1() {
now = new Date();
var sec = now.getSeconds();
oSec.style.transform="rotate("+sec*6+"deg)";
setTimeout(getNow1, 1000);
}
getNow1();
function getNow2() {
now = new Date();
var min = now.getMinutes();
oMin.style.transform="rotate("+min*6+"deg)"
setTimeout(getNow2, 1000);
}
getNow2();
function getNow3() {
now = new Date();
var hour = now.getHours();
oHour.style.transform="rotate("+hour*30+"deg)"
setTimeout(getNow3, 1000);
}
getNow3();
</script>
</body>
</html>