-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclock.html
More file actions
69 lines (63 loc) · 2.9 KB
/
clock.html
File metadata and controls
69 lines (63 loc) · 2.9 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Clock</title>
<link rel="stylesheet" type="text/css" href="./clock.css">
</head>
<body>
<svg viewBox="0 0 40 40">
<defs>
<g id="line">
<line x1="15" y1="0" x2="16" y2="0" />
</g>
</defs>
<circle cx="20" cy="20" r="19" />
<g class="marks">
<line x1="15" y1="0" x2="16" y2="0" transform="rotate(30)" />
<line x1="15" y1="0" x2="16" y2="0" transform="rotate(60)" />
<line x1="15" y1="0" x2="16" y2="0" transform="rotate(90)" />
<line x1="15" y1="0" x2="16" y2="0" transform="rotate(120)" />
<line x1="15" y1="0" x2="16" y2="0" transform="rotate(150)" />
<line x1="15" y1="0" x2="16" y2="0" transform="rotate(180)" />
<line x1="15" y1="0" x2="16" y2="0" />
<line x1="15" y1="0" x2="16" y2="0" />
<line x1="15" y1="0" x2="16" y2="0" />
<line x1="15" y1="0" x2="16" y2="0" />
<line x1="15" y1="0" x2="16" y2="0" />
<line x1="15" y1="0" x2="16" y2="0" />
<!-- <use xlink:href="#line" />
<use xlink:href="#line" transform="rotate(30)" />
<use xlink:href="#line" transform="rotate(60)" />
<use xlink:href="#line" transform="rotate(90)" />
<use xlink:href="#line" transform="rotate(120)" />
<use xlink:href="#line" transform="rotate(150)" />
<use xlink:href="#line" transform="rotate(180)" />
<use xlink:href="#line" transform="rotate(210)" />
<use xlink:href="#line" transform="rotate(240)" />
<use xlink:href="#line" transform="rotate(270)" />
<use xlink:href="#line" transform="rotate(300)" />
<use xlink:href="#line" transform="rotate(330)" /> -->
</g>
<circle cx="15" cy="25" r="2.5" class="seconds__circle" />
<line x1="0" y1="0" x2="9" y2="0" class="hour" />
<line x1="0" y1="0" x2="13" y2="0" class="minute" />
<line x1="0" y1="0" x2="16" y2="0" class="seconds" />
<line x1="15" y1="25" x2="17" y2="25" transform="rotate(100,15,25)" class="seconds__small"/>
<circle cx="20" cy="20" r="0.7" class="pin" />
</svg>
<script type="text/javascript">
/**
* Until CSS can enable us to tell time,
* we need js to set the correct time.
* The accuracy of this clock depends on that of your device.
* This is still a pure CSS clock because it's functionality is
* completely in CSS.
*/
const svg = document.querySelector('svg');
const currentTime = new Date();
svg.style.setProperty('--start-seconds', currentTime.getSeconds());
svg.style.setProperty('--start-minutes', currentTime.getMinutes());
svg.style.setProperty('--start-hours', currentTime.getHours() % 12);
</script>
</body>
</html>