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

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

One HTML file. Save it and open it in any browser.Open full screen

Example: Meridian, a sweeping SVG world clock for five cities.

The clock opens on London and its hands sweep in from twelve. The second hand then glides around continuously. Switch cities with the tabs, by clicking the face, with the ← → keys, or with 1–5. The hands ease to the new time along the shortest arc. The side panel shows the date, the UTC offset (try Mumbai for UTC+5:30) and the gap from your local time. The face turns dark in cities where it is night.

Written by AI from this prompt. Your results will vary.

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 in Animations & Effects