What it is
A lunar almanac around a 3D Moon. For any date, time and place it shows the phase, the illuminated fraction, the age since the last new Moon, moonrise, moonset and the highest point with their compass directions, the Moon's height now, its distance and apparent size, the zodiac constellation it is in, the libration, its path across your sky through the day, the next full and new Moon with countdowns, and a month of phase glyphs. The Moon is lit by the Sun from the true direction for that moment, tilted the way it looks from the chosen place, and turned by libration, so the face nods and swings through the month as it really does. A second view pulls back to the Earth and the Moon on its true orbit with the direction of sunlight.
Engineering decisions
- No astronomy library: the ephemeris is written in TypeScript after Jean Meeus, "Astronomical Algorithms": the Sun (chapter 25), the Moon with the full periodic tables of chapter 47, illumination and the position angle of the bright limb (chapter 48), optical libration (chapter 53), sidereal time and ΔT. Vitest checks it against Meeus' worked examples (Moon longitude within 0.002°, distance within 5 km, illuminated fraction, bright limb, libration) and against the published instants of the 2025 full and new Moons (all within 2 minutes).
- Principal phases are found by Newton steps on the Sun–Moon elongation rather than the series of chapter 49, so they come from the same theory as the picture. Moonrise and moonset are bracketed every 10 minutes through the local day and refined by bisection, with the standard altitude that allows for refraction, the Moon's semi-diameter and parallax; days without a rise or a set show a dash. The transit is the meridian crossing, as almanacs define it. Nine cases from the US Naval Observatory's API (Kyiv, New York and Sydney on three dates, including a day without a moonset) are in the tests and match within 3 minutes.
- The Moon's body frame follows Cassini's laws (the pole 1.54° from the ecliptic pole, the prime meridian towards the mean Earth); a test checks that the sub-Earth point in that frame equals the optical libration. The camera's "up" is the zenith of the chosen place, so the crescent tilts as it does in that sky and is upside down from the southern hemisphere.
- Surface: the albedo is the Clementine global mosaic (USGS, public domain), resampled once to the texture; the relief is generated: real named craters at their positions plus a few thousand random worn craters, turned into east and north slopes in the same texture so the shader needs a single lookup. The lighting is Lommel–Seeliger with a little Lambert and an opposition surge, which is why the full Moon looks flat and bright while the terminator shows long shadows. Earthshine is a second, blue-grey light from the Earth whose strength follows the Earth's phase seen from the Moon.
- Eclipses: at every full and new Moon the minimum distance between the Moon and the Earth's shadow axis (or the Sun) is found and compared with Danjon's shadow radii. The tests reproduce NASA's list of all eighteen eclipses of 2025–2028 with their types (total, partial, penumbral, annular). During a lunar eclipse the shader darkens the Moon by the penumbra and turns the umbra copper-red, the light the Earth's atmosphere bends into its shadow. Solar eclipses are geocentric: the page says whether and of which type, not where they are seen. Full Moons closer than 360,000 km are marked as supermoons.
- The Earth in the system view is painted from Natural Earth outlines (public domain), turned by sidereal time and tilted by the obliquity.
- Everything to read is HTML (the panel, the sky chart and the month strip are SVG), so screen readers and search engines get the numbers; the canvas is aria-hidden. Times are shown in the chosen place's time zone; the URL keeps the date, time and place so a link opens the same sky.
Performance
The scene renders only when something changes (time, drag, a view change), not every frame. The texture is built once while the loader is up; the low tier uses a 1024-pixel texture, fewer sphere segments and a lower pixel ratio. The location is asked for only when the visitor presses "Use my location" and is not stored or sent anywhere.