Gemini 4 Neon New
View raw output
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Analog Clock</title>
<style>
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html, body {
height: 100%;
}
body {
display: grid;
place-items: center;
background: radial-gradient(circle at center, #263142 0%, #111827 100%);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
overflow: hidden;
}
.clock-container {
width: min(88vmin, 460px);
height: min(88vmin, 460px);
filter: drop-shadow(0 24px 40px rgba(0, 0, 0, 0.45));
}
svg {
display: block;
width: 100%;
height: 100%;
user-select: none;
}
.clock-number {
fill: #0f172a;
font-size: 27px;
font-weight: 600;
text-anchor: middle;
dominant-baseline: central;
}
</style>
</head>
<body>
<main class="clock-container">
<svg id="clock" viewBox="0 0 400 400" role="img" aria-label="Analog clock showing current time">
<defs>
<linearGradient id="bezel-outer" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#e2e8f0" />
<stop offset="45%" stop-color="#94a3b8" />
<stop offset="100%" stop-color="#334155" />
</linearGradient>
<linearGradient id="bezel-inner" x1="100%" y1="100%" x2="0%" y2="0%">
<stop offset="0%" stop-color="#cbd5e1" />
<stop offset="100%" stop-color="#475569" />
</linearGradient>
<radialGradient id="dial-face" cx="50%" cy="42%" r="60%">
<stop offset="0%" stop-color="#ffffff" />
<stop offset="80%" stop-color="#f8fafc" />
<stop offset="100%" stop-color="#e2e8f0" />
</radialGradient>
<filter id="hand-shadow" x="-30%" y="-30%" width="160%" height="160%">
<feDropShadow dx="0" dy="3" stdDeviation="2.5" flood-color="#0f172a" flood-opacity="0.28" />
</filter>
</defs>
<!-- Clock Case & Dial -->
<circle cx="200" cy="200" r="192" fill="url(#bezel-outer)" />
<circle cx="200" cy="200" r="181" fill="url(#bezel-inner)" />
<circle cx="200" cy="200" r="176" fill="url(#dial-face)" />
<!-- Tick Marks & Numbers (populated by JS) -->
<g id="ticks"></g>
<g id="numbers"></g>
<!-- Clock Hands -->
<g filter="url(#hand-shadow)">
<g id="hour-hand">
<line x1="200" y1="222" x2="200" y2="104" stroke="#0f172a" stroke-width="8.5" stroke-linecap="round" />
</g>
<g id="minute-hand">
<line x1="200" y1="228" x2="200" y2="62" stroke="#1e293b" stroke-width="5.5" stroke-linecap="round" />
</g>
<g id="second-hand">
<line x1="200" y1="238" x2="200" y2="46" stroke="#dc2626" stroke-width="2.2" stroke-linecap="round" />
<line x1="200" y1="238" x2="200" y2="216" stroke="#dc2626" stroke-width="4.5" stroke-linecap="round" />
</g>
</g>
<!-- Center Pin -->
<circle cx="200" cy="200" r="8" fill="#0f172a" />
<circle cx="200" cy="200" r="3.5" fill="#dc2626" />
</svg>
</main>
<script>
(function () {
const SVG_NS = "http://www.w3.org/2000/svg";
const ticksGroup = document.getElementById("ticks");
const numbersGroup = document.getElementById("numbers");
const hourHand = document.getElementById("hour-hand");
const minuteHand = document.getElementById("minute-hand");
const secondHand = document.getElementById("second-hand");
const clockSvg = document.getElementById("clock");
const center = 200;
// Create 60 tick marks
for (let i = 0; i < 60; i++) {
const isHourTick = i % 5 === 0;
const angleRad = (i * 6 * Math.PI) / 180;
const outerR = 168;
const innerR = isHourTick ? 154 : 161;
const x1 = center + innerR * Math.sin(angleRad);
const y1 = center - innerR * Math.cos(angleRad);
const x2 = center + outerR * Math.sin(angleRad);
const y2 = center - outerR * Math.cos(angleRad);
const tick = document.createElementNS(SVG_NS, "line");
tick.setAttribute("x1", x1.toFixed(2));
tick.setAttribute("y1", y1.toFixed(2));
tick.setAttribute("x2", x2.toFixed(2));
tick.setAttribute("y2", y2.toFixed(2));
tick.setAttribute("stroke", isHourTick ? "#1e293b" : "#94a3b8");
tick.setAttribute("stroke-width", isHourTick ? "3.2" : "1.5");
tick.setAttribute("stroke-linecap", "round");
ticksGroup.appendChild(tick);
}
// Create numbers 1 to 12
const numberRadius = 131;
for (let num = 1; num <= 12; num++) {
const angleRad = (num * 30 * Math.PI) / 180;
const x = center + numberRadius * Math.sin(angleRad);
const y = center - numberRadius * Math.cos(angleRad);
const text = document.createElementNS(SVG_NS, "text");
text.setAttribute("x", x.toFixed(2));
text.setAttribute("y", y.toFixed(2));
text.setAttribute("class", "clock-number");
text.textContent = String(num);
numbersGroup.appendChild(text);
}
let lastAriaSecond = -1;
function updateClock() {
const now = new Date();
const ms = now.getMilliseconds();
const seconds = now.getSeconds() + ms / 1000;
const minutes = now.getMinutes() + seconds / 60;
const hours = (now.getHours() % 12) + minutes / 60;
const secondAngle = seconds * 6;
const minuteAngle = minutes * 6;
const hourAngle = hours * 30;
hourHand.setAttribute("transform", `rotate(${hourAngle.toFixed(3)} 200 200)`);
minuteHand.setAttribute("transform", `rotate(${minuteAngle.toFixed(3)} 200 200)`);
secondHand.setAttribute("transform", `rotate(${secondAngle.toFixed(3)} 200 200)`);
const wholeSecond = now.getSeconds();
if (wholeSecond !== lastAriaSecond) {
lastAriaSecond = wholeSecond;
clockSvg.setAttribute("aria-label", `Analog clock showing ${now.toLocaleTimeString()}`);
}
requestAnimationFrame(updateClock);
}
updateClock();
})();
</script>
</body>
</html>