← Back to Projects

Live Sky Scene

A small animated sky that shows what it looks like outside in Toronto right now, or anywhere else you point it.

Category Creative Coding
Data Open-Meteo weather and geocoding
Stack JavaScript, Canvas 2D, CSS

Overview

The scene opens on Toronto's real local time and current weather. Everything in the caption under it can be changed: type a city and press Enter, pick a time, or choose a different weather. Move the pointer over the sky to shift it slightly and part the rain or snow, and click to scatter a few sparks.

What it shows

  • Night, dawn, day and dusk, timed to that day's real sunrise and sunset for the chosen place.
  • A sun or moon that travels an arc across the sky, with stars and lit windows in the skyline after dark.
  • Six kinds of weather: clear, cloudy, rain, snow, fog and thunderstorm. Cloud cover sets how many clouds appear, and wind speed sets how fast they drift and how much the rain slants.
  • Every colour comes from the site's own palette, so the scene stays in the same warm greys and gold as the rest of the page.

Engineering notes

  • Plain JavaScript and the Canvas 2D API, with no libraries and no build step.
  • Weather, sunrise, sunset and the place's time zone come from Open-Meteo, which needs no API key. City names are looked up with Open-Meteo's geocoding service. Data refreshes every 15 minutes.
  • The browser only asks for location when "Use my location" is clicked. A chosen city is remembered on the visitor's device until they press Reset.
  • Animation pauses when the scene scrolls out of view or the tab is hidden. With reduced motion turned on, the scene is drawn as a still picture.
  • If the weather service cannot be reached, the scene falls back to the visitor's own clock and a clear sky.
All Projects Back to Projects →