-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClock.html
94 lines (85 loc) · 2.33 KB
/
Clock.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9"
crossorigin="anonymous"
/>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
/* background: linear-gradient(45deg, #ff6b6b, #3498db); */
animation: gradientAnimation 10s infinite alternate;
}
.clock {
position: relative;
width: 200px;
height: 200px;
border-radius: 50%;
background: rgba(37, 35, 35, 0.1);
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
overflow: hidden;
}
.clock-face {
position: relative;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.hand {
position: absolute;
top: 50%;
left: 50%;
transform-origin: bottom center;
transition: transform 0.5s cubic-bezier();
}
.hour {
width: 6px;
height: 40px;
background-color: #292c3d;
}
.minutes {
width: 4px;
height: 60px;
background-color: #292c3d;
}
.second {
width: 02px;
height: 70px;
background-color: #ff6b6b;
}
</style>
<title>Document</title>
</head>
<body>
<div class="clock">
<div class="clock-face">
<div class="hand hour" id="hour-hand"></div>
<div class="hand minutes" id=" minute-hand"></div>
<div class="hand second" id=" second-hand"></div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/dayjs"z></script>
<script>
function updateClock() {
const hourHand = document.getElementById("hour-hand");
const minuteHand = document.getElementById("minute-hand");
const secondHand = document.getElementById("second-hand");
const now = dayjs();
const hours = now.hour();
const minutes = now.minute();
const second = now.second();
const hourDeg = hour(12 / 6);
}
</script>
</body>
</html>