File size: 11,501 Bytes
a4980d2 | 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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Beautiful Analog Clock</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.clock-face {
background: radial-gradient(circle at center, #f9f9f9, #e0e0e0);
box-shadow:
0 0 0 8px rgba(255,255,255,0.8),
inset 0 0 15px rgba(0,0,0,0.1),
0 15px 30px rgba(0,0,0,0.15);
border: 1px solid rgba(255,255,255,0.5);
}
.clock-center {
width: 16px;
height: 16px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 50%;
background: radial-gradient(circle at 30% 30%, #fff, #c0392b);
border: 2px solid #2c3e50;
box-shadow: 0 0 10px rgba(0,0,0,0.3);
z-index: 10;
}
.hour-hand, .minute-hand, .second-hand {
transform-origin: 50% 100%;
position: absolute;
top: 50%;
left: 50%;
border-radius: 10px;
transition: transform 0.5s cubic-bezier(0.4, 2.3, 0.3, 1);
}
.hour-hand {
width: 8px;
height: 30%;
margin-top: -30%;
margin-left: -4px;
background: linear-gradient(to top, #2c3e50, #34495e);
box-shadow: 0 0 5px rgba(0,0,0,0.3);
border-radius: 8px;
z-index: 3;
}
.minute-hand {
width: 5px;
height: 40%;
margin-top: -40%;
margin-left: -2.5px;
background: linear-gradient(to top, #34495e, #7f8c8d);
box-shadow: 0 0 5px rgba(0,0,0,0.2);
border-radius: 8px;
z-index: 4;
}
.second-hand {
width: 2px;
height: 45%;
margin-top: -45%;
margin-left: -1px;
background: linear-gradient(to top, #e74c3c, #c0392b);
box-shadow: 0 0 5px rgba(231, 76, 60, 0.5);
z-index: 5;
}
.tick {
position: absolute;
width: 100%;
height: 100%;
text-align: center;
font-weight: bold;
color: #333;
}
.tick::after {
content: '';
position: absolute;
top: 10px;
left: 50%;
transform: translateX(-50%);
width: 3px;
height: 15px;
background: linear-gradient(to bottom, #2c3e50, #7f8c8d);
border-radius: 3px;
box-shadow: 0 0 3px rgba(0,0,0,0.2);
}
.tick-number {
position: absolute;
width: 30px;
height: 30px;
text-align: center;
font-weight: bold;
color: #333;
font-size: 1.2rem;
transform-origin: center center;
line-height: 30px;
left: 50%;
top: 50%;
margin-left: -15px;
margin-top: -15px;
display: flex;
align-items: center;
justify-content: center;
transform: translate(0, -5px);
}
@keyframes rotate {
100% {
transform: rotate(360deg);
}
}
.clock-decoration {
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
background: radial-gradient(circle at center, transparent 60%, rgba(255,255,255,0.1) 60.5%, transparent 61%);
}
</style>
</head>
<body class="bg-gradient-to-br from-gray-100 to-gray-300 min-h-screen flex items-center justify-center p-4">
<div class="relative">
<!-- Clock container -->
<div class="clock-face bg-white rounded-full shadow-xl relative" style="width: 300px; height: 300px;">
<!-- Decorative elements -->
<div class="clock-decoration"></div>
<!-- Clock center -->
<div class="clock-center"></div>
<!-- Clock hands -->
<div class="hour-hand" id="hour-hand"></div>
<div class="minute-hand" id="minute-hand"></div>
<div class="second-hand" id="second-hand"></div>
<!-- Clock ticks and numbers -->
<div class="absolute inset-0">
<!-- Numbers -->
<div class="tick-number" style="transform: rotate(30deg) translate(0, -110px) rotate(-30deg); transform-origin: center center;">1</div>
<div class="tick-number" style="transform: rotate(60deg) translate(0, -110px) rotate(-60deg); transform-origin: center center;">2</div>
<div class="tick-number" style="transform: rotate(90deg) translate(0, -110px) rotate(-90deg); transform-origin: center center;">3</div>
<div class="tick-number" style="transform: rotate(120deg) translate(0, -110px) rotate(-120deg); transform-origin: center center;">4</div>
<div class="tick-number" style="transform: rotate(150deg) translate(0, -110px) rotate(-150deg); transform-origin: center center;">5</div>
<div class="tick-number" style="transform: rotate(180deg) translate(0, -110px) rotate(-180deg); transform-origin: center center;">6</div>
<div class="tick-number" style="transform: rotate(210deg) translate(0, -110px) rotate(-210deg); transform-origin: center center;">7</div>
<div class="tick-number" style="transform: rotate(240deg) translate(0, -110px) rotate(-240deg); transform-origin: center center;">8</div>
<div class="tick-number" style="transform: rotate(270deg) translate(0, -110px) rotate(-270deg); transform-origin: center center;">9</div>
<div class="tick-number" style="transform: rotate(300deg) translate(0, -110px) rotate(-300deg); transform-origin: center center;">10</div>
<div class="tick-number" style="transform: rotate(330deg) translate(0, -110px) rotate(-330deg); transform-origin: center center;">11</div>
<div class="tick-number" style="transform: rotate(0deg) translate(0, -110px) rotate(0deg); transform-origin: center center;">12</div>
<!-- Ticks -->
<div class="tick" style="transform: rotate(0deg);"></div>
<div class="tick" style="transform: rotate(30deg);"></div>
<div class="tick" style="transform: rotate(60deg);"></div>
<div class="tick" style="transform: rotate(90deg);"></div>
<div class="tick" style="transform: rotate(120deg);"></div>
<div class="tick" style="transform: rotate(150deg);"></div>
<div class="tick" style="transform: rotate(180deg);"></div>
<div class="tick" style="transform: rotate(210deg);"></div>
<div class="tick" style="transform: rotate(240deg);"></div>
<div class="tick" style="transform: rotate(270deg);"></div>
<div class="tick" style="transform: rotate(300deg);"></div>
<div class="tick" style="transform: rotate(330deg);"></div>
</div>
</div>
<!-- Digital time display -->
<div class="mt-8 text-center">
<div class="text-4xl font-light tracking-wider text-gray-700" id="digital-time">00:00:00</div>
<div class="text-lg font-medium text-gray-500 mt-3 tracking-wide" id="date-display">Monday, January 1, 2023</div>
</div>
</div>
<script>
function updateClock() {
const now = new Date();
// Get time components
const hours = now.getHours();
const twelveHourFormat = hours % 12 || 12; // Convert 0 to 12 for 12-hour format
const minutes = now.getMinutes();
const seconds = now.getSeconds();
const milliseconds = now.getMilliseconds();
// Announce the hour at the top of each hour
if (minutes === 0 && seconds === 0) {
const speech = new SpeechSynthesisUtterance();
speech.text = `It's ${twelveHourFormat} o'clock`;
speech.volume = 0.8;
speech.rate = 0.9;
speech.pitch = 1;
window.speechSynthesis.speak(speech);
}
// Calculate angles for clock hands (use twelveHourFormat for display)
const hourAngle = (twelveHourFormat * 30) + (minutes * 0.5);
const minuteAngle = (minutes * 6) + (seconds * 0.1);
const secondAngle = (seconds * 6) + (milliseconds * 0.006);
// Update clock hands
document.getElementById('hour-hand').style.transform = `rotate(${hourAngle}deg)`;
document.getElementById('minute-hand').style.transform = `rotate(${minuteAngle}deg)`;
document.getElementById('second-hand').style.transform = `rotate(${secondAngle}deg)`;
// Update digital time
const formattedHours = String(now.getHours()).padStart(2, '0');
const formattedMinutes = String(minutes).padStart(2, '0');
const formattedSeconds = String(seconds).padStart(2, '0');
document.getElementById('digital-time').textContent = `${formattedHours}:${formattedMinutes}:${formattedSeconds}`;
// Update date display
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
document.getElementById('date-display').textContent = now.toLocaleDateString('en-US', options);
}
// Update clock immediately and then every 50ms for smooth animation
updateClock();
setInterval(updateClock, 50);
// Add some interactive effects
const clock = document.querySelector('.clock-face');
clock.addEventListener('mouseenter', () => {
clock.classList.add('transform', 'scale-105');
clock.classList.remove('shadow-xl');
clock.classList.add('shadow-2xl');
});
clock.addEventListener('mouseleave', () => {
clock.classList.remove('transform', 'scale-105');
clock.classList.add('shadow-xl');
clock.classList.remove('shadow-2xl');
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=ionel/clock" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |