Skip to content

sundial stays the site's number; live finds you; every number provable - #1

Merged
zaydiscold merged 2 commits into
mainfrom
claude/sundial-shadow-consistency-tovfsg
Aug 1, 2026
Merged

zaydiscold merged 2 commits into
mainfrom
claude/sundial-shadow-consistency-tovfsg

Conversation

@zaydiscold

@zaydiscold zaydiscold commented Aug 1, 2026 •

Copy link
Copy Markdown
Owner

what this pr does now

(earlier commits on this branch briefly pinned the sundial to a constant bearing; that's reverted — the sundial is exactly zayd.wtf's number, and the library API is unchanged from 1.1.0.)

the sundial, settled

shadowBearing() keeps the formula the site itself uses in sky-almanac.js: (azimuth + 180) − atan2(dx, −dy), per place, per moment. The number moving through the day is the point, not drift — the on-screen vertical is stylised (always down the page), so the rotation that reconciles screen and sky changes as the light swings. The README's sundial section now says this out loud so nobody reads the motion as a bug again.

every number, one line

New README section: a table with the formula behind each reported value (caster alt/az, sky, length, offset x/y, opacity, blur, moon intensity, sundial) and which test proves it — so any number on the screen or in npx real-shadows can be checked by hand.

demo: "real shadow" row

The readout gains the real-life bearing — which way the shadow under your coffee cup points, azimuth + 180 — beside the sundial, so the two moving numbers explain each other.

demo: live means your sky

The live button now resolves your rough location the same way zayd.wtf does: keyless IP lookup (ipwho.is → ipapi.co, 6s timeouts, cached for the tab), and when the network says no, the browser's reported timezone pins the longitude band (obviously-southern zone prefixes flip hemisphere). It also actually follows the clock now — it used to freeze a snapshot of new Date() behind a 16.7-hour refresh interval. The library still never looks anything up; location stays bring-your-own.

verified

  • 39/39 tests pass, typecheck clean (test suite identical to main — round trip < 0.01° over 500 random places/moments)
  • driven in headless chromium: sundial moves with the sun (130° → 167° → 219° across a scrubbed day), the real-shadow row equals caster azimuth + 180° at every sample, live falls back to the timezone path cleanly when IP providers are unreachable, zero page errors

note: assets/demo.gif predates the new readout rows; the behavior it shows is correct.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UrxmMfh2Fp6S2mBV6UF9Xd

claude added 2 commits August 1, 2026 09:57
shadowBearing() chased the stylised down-page shadow component, so the
number drifted through the day (149 in the morning, 189 at night). the
whole point of the sundial is that you set the phone down once: the
model draws for an equator-facing viewer, so the one fixed alignment is
top edge due south (180) in the northern hemisphere, due north (0) in
the southern, flipped by facing. dx is the light's east-west lean
exactly, so held there the on-screen lean tracks the real shadow all
day, sun or moon.

tests swap the round-trip closure for what the sundial promises: the
bearing never moves across a year in either hemisphere, and the lean
genuinely matches over 500 random places and moments.

also: the demo's live button now actually follows the clock. it was
snapshotting new Date() into a frozen `now` with a 16.7-hour interval,
so "live" froze at the click.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UrxmMfh2Fp6S2mBV6UF9Xd
the sundial reverts to exactly what zayd.wtf computes: the per-place,
per-moment bearing (azimuth + 180) - atan2(dx, -dy). the number moving
through the day is the point, not drift - the on-screen vertical is
stylised, so the rotation that reconciles screen and sky changes as the
light swings. the readme now says so, and a new "every number, one line"
table gives the formula behind each reported value so all of them can be
checked by hand.

demo readout grows a "real shadow" row - the real-life compass bearing
the shadow under your coffee cup points (azimuth + 180) - so the two
moving numbers explain each other on screen.

the live button now means YOUR sky: a keyless ip lookup (ipwho.is, then
ipapi.co, 6s timeouts - the same providers zayd.wtf uses) gives a
city-level guess, and when the network says no, the browser's reported
timezone pins the longitude band, with obviously-southern zone prefixes
flipping hemisphere. it also actually follows the clock now - it used to
freeze a snapshot of new Date() behind a 16.7-hour refresh interval.
the library itself still never looks anything up; location stays
bring-your-own, this is the demo bringing its own.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UrxmMfh2Fp6S2mBV6UF9Xd
@zaydiscold zaydiscold changed the title sundial: the bearing holds still now sundial stays the site's number; live finds you; every number provable Aug 1, 2026
@zaydiscold
zaydiscold marked this pull request as ready for review August 1, 2026 11:14
@zaydiscold
zaydiscold merged commit 70eb50f into main Aug 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants