-
Notifications
You must be signed in to change notification settings - Fork 0
/
clock.css
114 lines (96 loc) · 1.71 KB
/
clock.css
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
html, body {
height: 100%;
margin: 0;
}
body {
cursor: pointer;
display: flex;
}
td {
padding: 0 0.2em;
}
td.selected {
background-color: black;
border-radius: 0.2em;
color: white;
}
fieldset {
border: 0;
margin: 0;
padding: 0;
}
input.small {
text-align: right;
width: 3em;
}
span {
margin: 1em;
}
ul, div {
background-color: rgba(255, 255, 255, 0.7);
border-radius: 0.2em;
color: black;
font-family: sans-serif;
margin: 1em;
padding: 0.5em 2em;
}
/* 00-clock-analogue from https://github.com/webondevices/html-css-wizardry/tree/main/07-calc */
:root {
--second: 1s;
--minute: calc(var(--second) * 60);
--hour: calc(var(--minute) * 60);
}
@keyframes rotate {
from {
transform: rotate(0);
}
to {
transform: rotate(1turn);
}
}
.clock {
width: 15em;
height: 15em;
border-radius: 50%;
background-color: grey;
margin: 0;
padding: 0;
position: relative;
transform: rotate(180deg);
}
.hand {
position: absolute;
top: 50%;
left: calc(50% - var(--width) / 2);
width: var(--width);
border-radius: calc(var(--width) / 2);
height: var(--height);
margin: 0;
padding: 0;
background-color: var(--color);
transform-origin: center 0;
}
.second {
--width: 3px;
--height: 47%;
--color: red;
}
.minute {
--width: 7px;
--height: 43%;
--color: black;
}
.hour {
--width: 9px;
--height: 30%;
--color: #333;
}
.second.hand {
animation: rotate steps(60) var(--minute) infinite;
}
.minute.hand {
animation: rotate linear var(--hour) infinite;
}
.hour.hand {
animation: rotate linear calc(var(--hour) * 12) infinite;
}