forked from cakenggt/web-fractal-clock
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
89 lines (78 loc) · 2.47 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
82
83
84
85
86
87
88
89
<!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">
<script type="text/javascript">
const total = 0;
const minOpacity = 0.1;
const maxOpacity = 0.5;
const colorFloor = 190;
window.onload = () => {
for (let i = 0; i < total; i++){
document.querySelectorAll('.hand:empty').forEach(n => {
n.innerHTML = `<div class="hand rotate-minute" ${style}></div><div class="hand rotate-second" ${style}></div>`;
});
}
var css = document.createElement('style');
css.type = 'text/css';
var hours = new Date().getHours()%12;
var minutes = new Date().getMinutes();
var seconds = new Date().getSeconds()+(60*minutes)+(60*60*hours);
var styles = `.hand {animation-delay: ${seconds*-1}s;}`;
if (css.styleSheet) css.styleSheet.cssText = styles;
else css.appendChild(document.createTextNode(styles));
document.getElementsByTagName("head")[0].appendChild(css);
};
</script>
<style>
@keyframes rotating {
from {
transform: rotate(180deg);
}
to {
transform: rotate(540deg);
}
}
.rotate-second {
animation: rotating 60.083449s linear infinite; /*(60*60*12)/((60*12)-1)*/
}
.rotate-minute {
animation: rotating 3927.27273s linear infinite; /*(60*60*12)/(12-1)*/
}
.rotate-hour {
animation: rotating 43200s linear infinite;
}
.hand {
display: inline-block;
transform-origin: 50% 100%;
width: 1px;
height: 20vmin;
position: absolute;
left: 0;
bottom: 100%;
background-color: white;
border-radius: 100px;
}
.hour {
position: fixed;
background-color: white;
left: 50%;
bottom: 50%;
width: 2px;
height: 10vmin;
transform-origin: 50% 50%;
}
body {
background-color: black;
}
</style>
</head>
<body>
<div class="hand rotate-hour hour">
<div class="hand rotate-minute"></div>
<div class="hand rotate-second"></div>
</div>
</body>
</html>