Animate an Analog Clock
Beautiful animated analog clock with smooth hands, customizable styles, and real-time display. Pastel design with multiple face presets.
About
An analog clock face maps continuous time onto circular geometry. The hour hand completes one full revolution (360°) every 12 hours, the minute hand every 60 minutes, and the second hand every 60 seconds. Errors in hand positioning compound visually: a 1° offset on the minute hand corresponds to 10 seconds of drift. This implementation uses sub-second interpolation from Date.getMilliseconds to produce smooth, continuous motion rather than discrete ticking. All trigonometric calculations use radians with offset −π⁄2 so that angle zero points to 12 o'clock.
The clock renders on an HTML Canvas at device-pixel-ratio resolution to prevent aliasing on high-DPI screens. Hand lengths follow horological convention: hour hand at 50% of radius, minute at 75%, second at 85%. Note: this tool reads your system clock. If your OS time is wrong, the displayed time will be wrong. It does not sync to NTP.
Formulas
Each clock hand angle θ is computed from the current time components. The offset −π2 rotates the coordinate system so 0 radians points upward (12 o'clock) instead of rightward.
The endpoint of each hand at radius r from center (cx, cy):
Where s = seconds, ms = milliseconds, m = minutes, h = hours (24-hour), r = hand length, cx/cy = canvas center coordinates.
Reference Data
| Hand | Full Rotation | Degrees per Unit | Radians per Unit | Typical Length (% of radius) | Typical Width |
|---|---|---|---|---|---|
| Hour | 12 h | 0.5°/min | 0.00873 rad/min | 50% | Thick |
| Minute | 60 min | 6°/min | 0.10472 rad/min | 75% | Medium |
| Second | 60 s | 6°/s | 0.10472 rad/s | 85% | Thin |
| Hour Marks | - | 30° apart | π⁄6 apart | - | - |
| Minute Marks | - | 6° apart | π⁄30 apart | - | - |
| Hour Hand (per hour) | - | 30°/h | 0.5236 rad/h | - | - |
| Minute Hand (per second) | - | 0.1°/s | 0.001745 rad/s | - | - |
| Second Hand (per ms) | - | 0.006°/ms | 0.000105 rad/ms | - | - |
| 12-hour overlap count | 12 h | Hour and minute hands overlap 11 times (not 12) every 12 hours | |||
| Overlap interval | - | 65 min 27.27 s between overlaps | |||
| DPI Scaling | - | devicePixelRatio multiplied on canvas dimensions for crisp rendering | |||
| Frame Budget (60fps) | - | 16.67 ms per frame maximum | |||