-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnalogClock.html
99 lines (89 loc) · 2.46 KB
/
AnalogClock.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Analog Clock</title>
<style>
body {
background: url(analogp2.jpg);
background-size: cover;
height: 95vh;
background-position: center;
background-repeat: no-repeat;
display: inline-block;
}
div>img {
margin: 5px 0px;
height: 85px;
}
#hide_circle {
height: 12rem;
width: 9rem;
border-radius: 100%;
position: absolute;
top: 38%;
right: 43%;
background-color: #e9ebe8;
}
#mid_circle {
height: 1.4rem;
width: 1.4rem;
border-radius: 100%;
background-color: #4f363e;
position: absolute;
top: 47%;
right: 49%;
}
#hour {
height: 5rem;
width: 0.45rem;
background-color: #4f363eeb;
position: absolute;
top: 48.3%;
right: 49.55%;
transform-origin: top;
}
#minute {
height: 7.5rem;
width: 0.3rem;
background-color: #4f363eeb;
position: absolute;
top: 48.3%;
right: 49.55%;
transform-origin: top;
}
#second {
height: 9rem;
width: 0.15rem;
background-color: #4f363eeb;
position: absolute;
top: 48.3%;
right: 49.55%;
transform-origin: top;
}
</style>
</head>
<body>
<div>
<img src="Clocklogo.png" alt="Clock.com">
</div>
<div id="hide_circle"></div>
<div id="mid_circle"></div>
<div id="hour"></div>
<div id="minute"></div>
<div id="second"></div>
</body>
<script>
setInterval(() => {
let d = new Date();
let h = (((d.getHours() * 30) + (d.getMinutes() / 2) + d.getSeconds() / 120) - 180) + "deg";
let m = (((d.getMinutes() * 6) + (d.getSeconds() / 10)) - 180) + "deg";
let s = ((d.getSeconds() * 6) - 180) + "deg";
hour.style.transform = "rotate(" + h + ")";
minute.style.transform = "rotate(" + m + ")";
second.style.transform = "rotate(" + s + ")";
}, 1000);
</script>
</html>