-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
136 lines (127 loc) · 4.65 KB
/
index.html
File metadata and controls
136 lines (127 loc) · 4.65 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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="Time, Clock, Current time, Hours, Seconds, Minutes, Date, Timer, Alarm">
<meta name="description" content="The official Hopyard Farm neighborhood website.">
<meta name='language' content='EN'>
<meta name="robots" content="index, follow">
<meta name="revised" content="Tuesday, Feburary 18th, 2025, 6:00 pm">
<link rel="icon" type="image/png" href="/time/icon/favicon-96x96.png" sizes="96x96" />
<link rel="icon" type="image/svg+xml" href="/time/icon/favicon.svg" />
<link rel="shortcut icon" href="/time/icon/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/time/icon/apple-touch-icon.png" />
<link rel="manifest" href="/time/icon/site.webmanifest" />
<title>Current Time</title>
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
text-align: center;
background-color: #282c36;
color: white;
}
#time {
font-size: 8rem;
font-weight: bold;
}
.clock {
position: relative;
width: 300px;
height: 300px;
border: 5px solid white;
border-radius: 50%;
margin-top: 40px;
display: flex;
align-items: center;
justify-content: center;
}
.hand {
position: absolute;
bottom: 50%;
left: 50%;
transform-origin: bottom;
background-color: white;
border-radius: 5px;
}
.hour {
width: 8px;
height: 80px;
}
.minute {
width: 8px;
height: 100px;
}
.second {
width: 2px;
height: 120px;
background-color: red;
}
.clock-face {
position: absolute;
width: 100%;
height: 100%;
}
.mark {
position: absolute;
width: 2px;
height: 15px;
background-color: white;
top: 50%;
left: 50%;
transform-origin: center;
}
.mark.large {
height: 20px;
width: 4px;
}
</style>
</head>
<body>
<div id="time">Loading...</div>
<div class="clock">
<div class="clock-face" id="clock-face"></div>
<div class="hand hour" id="hour-hand"></div>
<div class="hand minute" id="minute-hand"></div>
<div class="hand second" id="second-hand"></div>
</div>
<script>
function updateTime() {
const now = new Date();
let hours = now.getHours() % 12;
hours = hours === 0 ? 12 : hours;
const minutes = now.getMinutes();
const seconds = now.getSeconds();
document.getElementById('time').textContent = `${hours}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
const hourHand = document.getElementById('hour-hand');
const minuteHand = document.getElementById('minute-hand');
const secondHand = document.getElementById('second-hand');
const hourDeg = hours * 30 + minutes * 0.5;
const minuteDeg = minutes * 6;
const secondDeg = seconds * 6;
hourHand.style.transform = `translate(-50%, 0) rotate(${hourDeg}deg)`;
minuteHand.style.transform = `translate(-50%, 0) rotate(${minuteDeg}deg)`;
secondHand.style.transform = `translate(-50%, 0) rotate(${secondDeg}deg)`;
}
function createClockMarks() {
const clockFace = document.getElementById('clock-face');
for (let i = 0; i < 60; i++) {
const mark = document.createElement('div');
mark.classList.add('mark');
if (i % 5 === 0) mark.classList.add('large');
mark.style.transform = `translate(-50%, -50%) rotate(${i * 6}deg) translateY(-130px)`;
clockFace.appendChild(mark);
}
}
createClockMarks();
updateTime();
setInterval(updateTime, 1000);
</script>
</body>
</html>