Build an Animated SVG World Clock with Sweeping Hands and Five Time Zones
A single HTML file with a crisp SVG analog clock whose hands glide continuously and ease smoothly between five world cities, each with a labeled UTC offset.
You getone complete HTML file in a single code block, then 3 short ideas to extend it.
The prompt
Act as a senior front-end developer and visual designer. Build "Meridian", an animated world clock. It is a crisp SVG analog clock whose hands sweep continuously, and it switches among five cities: New York, London, Mumbai, Tokyo and Sydney.
Core: draw the face in SVG with 60 ticks (thicker every fifth), numerals 1 to 12, an hour hand, a minute hand and a coral second hand with a small counterweight. Get each city's real time with Intl.DateTimeFormat and its timeZone option. Recompute the UTC offsets every 30 seconds so daylight saving stays correct, and keep fixed fallback offsets.
Rules:
- Animate with requestAnimationFrame so the second hand glides. When switching cities, ease each hand along the shortest arc over about 0.7 seconds.
- Let visitors switch cities four ways: tab buttons that show each city's time and UTC offset, a click on the clock face, the Left and Right arrow keys, or keys 1 to 5.
- Add a side panel with the city name, 24-hour digital time, date, a labeled offset like UTC+5:30, and how many hours ahead of or behind the visitor it is.
- Tint the face dark between 18:00 and 06:00 and show a Daytime or Night label.
- Under prefers-reduced-motion, tick the second hand once per second and skip the easing.
- Use a navy, cream and coral palette and system fonts. The layout must work from 360 to 1280px wide, show visible focus outlines, and use no external resources or storage.
Output format: one complete HTML file in a single code block, then 3 short ideas to extend it.Example output
Tips and common edits
Why this works
- Intl.DateTimeFormat with timeZone works offline and handles daylight saving, so every city shows the correct time without any API.
- Easing along the shortest arc on each switch keeps the hands from spinning wildly when a city is many hours away.
- A single requestAnimationFrame loop drives the hands, while the text updates only once per second, which keeps it smooth and light.
Paste the prompt into ChatGPT, Claude or Gemini. Save the code it returns as meridian.html and open it in any modern browser, or run it in the chat's preview or canvas panel.
Common edits
- Swap the cities by changing the five IANA zone names, for example Africa/Lagos or America/Sao_Paulo, and their fallback offsets.
- Add a soft Web Audio tick on each second behind a mute toggle, or change the coral accent and night tint to match your brand.
Prompt details
- By
- Prompts-GPT editors
- Published
Did this prompt work?
Keep exploring
More like this
Build a Self-Drawing SVG Lighthouse Line Animation in One HTML File
You get a single HTML page where a hand-built SVG lighthouse draws itself stroke by stroke with staggered timing, then fades in its colors, with replay and speed controls.
Build an Interactive Particle Network Background With Mouse and Touch Controls
A single HTML file with a full-screen canvas particle network that links nearby dots, reacts to mouse and touch, and has density, color and low-power controls.
Build a CSS Cubic-Bezier Easing Curve Visualizer with Draggable Handles
A single HTML file with a draggable bezier curve editor that races test boxes against CSS built-in easings and gives you a ready-to-paste cubic-bezier value.
Build an Animated Headline Text Reveal Playground in a Single HTML File
A one-file playground where you type a headline, preview typewriter, letter stagger, mask wipe or scramble reveals, and copy clean code for the chosen effect.
Build an Animated Number Counter and Progress Ring Stats Dashboard in HTML
You get a single HTML stats section where numbers ease up to their targets and SVG progress rings fill on scroll, with an editor panel and screen-reader announcements.
Build an Animated SVG Wave and Liquid Fill Background Generator
A single HTML file that generates layered, seamlessly looping SVG waves with live controls and exports ready-to-use animated SVG and CSS code.