Skip to content
julerexPublic

Repository files navigation

tothemoon

Interactive Three.js mission theaters. Open the site to the mission list (no HUD — flight cards only):

Mission Status
Starbase → Moon Full theater (ascent → low Earth orbit → translunar coast → ballistic lunar flyby)
Starship Flight 13 Full theater (staged ascent → suborbital coast → entry → Indian Ocean splashdown → sea-level drone hold through T+1:10); craft trail is Earth-fixed (co-rotates / revolves with the globe)
Starship Flight 14 Full theater (first orbital flight: staged ascent → insertion ~275 km → 26 Starlink V3 → deorbit → Pacific splashdown → sea-level drone hold); craft trail is Earth-fixed

Live: https://julerex.github.io/tothemoon/

Deep links: #/ and #/missions mission list · #/glossary Glossary · #/mission/to-the-moon · #/mission/flight-13 · #/mission/flight-14

Time-seek URLs (every mission): append ?t= on the hash to open at that mission clock. Liftoff is t=0. Examples: #/mission/flight-13?t=1:05:21 (official splash), #/mission/flight-13?t=-0:05:00 (T− hold), #/mission/to-the-moon?t=T+50:00:00. Accepts T+/T− clocks, H:MM:SS, M:SS, raw seconds, and 1h5m21s. The address bar stays in sync as you scrub or play so you can copy a shareable URL.

Physics

  • True scale — scene unit = 1 km; real Earth/Moon radii and ~384 400 km semi-major axis
  • Restricted n-body + Earth J₂ — craft integrated with RK4 under Earth + Moon + Sun point-mass gravity, Earth J₂ (WGS84 equatorial radius), and a US76-ish piecewise atmosphere / quadratic drag below ~150 km geodetic height. Flight 13 entry Cd·A/m and L/D vary with altitude (theater-bounded). Pad, splash, and low-altitude floors sit on the WGS84 ellipsoid (same figure as the visual globe). Coast steps tighten near the Moon (0.5 s inside 8_000 km); the pack stores a step-doubling |Δr| / Moon-relative energy residual.
  • Staged ascent (A5) — booster throttle schedule (Maximum dynamic pressure dip + main engine cutoff ramp), hot-stage (booster throttle-down → ship ignition → separation), then an integrated ship circularize on RK4 (no residual path blend / Δv cap). Not flight-ops tables
  • Translunar coast → capture — after a hot super-Hohmann translunar injection the craft coasts ballistically under restricted n-body gravity. Transfer search aims a design perilune + south-pole B-plane (not closest-approach-anywhere). LOI is a finite burn; if it does not bind, the pack is a flyby (no polar LLO teleport). Bound capture then coasts low lunar orbit (~¾ rev), powered descent, and a sub-km surface floor at the landing radial (no great-circle taxi). A low-opacity Kepler 2-body corridor (dashed amber + sparse whiskers, toggle O) shows how the n-body path diverges from the inject osculating ellipse; max |Δr| is in metrics (M)
  • Heliocentric theater (Sun ≈ origin): JPL Horizons DE441 samples for Earth/Moon over the July 2027 lunar window (npm run horizons); Flight 13 launch-window table is packed (horizons:flight13) while the F13 bake stays analytic so the pad frame matches. Analytic circular Earth + Keplerian Moon (mean Ω̇ / ω̇) as fallback.
  • Mission: Starbase pad → staged ascent → integrated low Earth orbit dogleg (out-of-plane thrust on RK4, paid ship Δv) → finite translunar injection (no end-of-burn velocity snap) → n-body coast → LOI → LLO → powered descent → land
  • Mass-coupled thrust — peak engine force F, acceleration a = F/m(t), pure rocket-equation ṁ (Isp) through translunar injection; empty tanks cut engines
  • Super Heavy recovery — detached booster is RK4-integrated on Earth μ + J₂ + drag after stage-out (boostback + landing burn booked on leftover prop). Landing burn starts at the public T+ mark (~5 km AGL chopsticks / ~3.5 km Flight 13 gulf). Lunar chopsticks seats on the tower; Flight 13 gulf is a hard splash after a 10→8→5 inner-13 relight
  • Trajectory is baked at build time into src/data/trajectory.json (instant load; no RK4 on the main thread). Flight 13 / Flight 14 packs live beside it (flight13-trajectory.json, flight14-trajectory.json; npm run precompute:flight14). Pack v2 also stores minMoonAlt, peak inertial speed, and stage-out time so the complete card never re-scans samples at load

The craft mesh is a near-true-size Super Heavy + Starship stack (tens of meters): ring welds, denser heat-shield tiles, Raptor field, multi-layer additive plumes that change by regime (pink–magenta in atmosphere / landing vs cooler vacuum / LOI looks) plus an axial exhaust stream on pad/ascent, dual exhaust lights in hot-stage, Super Heavy cryo frost + ice shed, maximum dynamic pressure condensation, and scrub-safe thrust lag. The booster stages off at low Earth orbit insert with fallaway + flash, a dim amber free-flyer locator (~30 s), and a brief boostback ignition flash; plumes scale with thrust. Starbase pad (flame trench, denser deluge steam, dual Mechazilla towers — live OLP-2 plus empty OLP-1) sits on a Sentinel-2 surrounds plate (~80 km square, Copernicus / EOX cloudless) plus five landward 80 km neighbors (N / NW / W / SW / S; the Gulf stays Blue Marble) with a nested USDA NAIP pad plate (~8 km square, 60 cm public-domain orthoimagery). Earth uses a NASA Blue Marble albedo (procedural night-lights, stronger atmospheric limb, soft anti-sun fill); the Moon uses an LRO WAC color mosaic (procedural fallback) plus dim Earthshine. Lunar landing site beacon + dust puff mark touchdown. In system views the vehicle is tiny — STARSHIP and SUPER HEAVY name plates mark each stage. Use the Ship camera to see liftoff up close.

Texture credits (NASA Blue Marble, LRO WAC Moon, Sentinel-2 cloudless, USDA NAIP, NASA star map) live in public/textures/ATTRIBUTION.txt.

Features

  • Loading overlay while Earth / Moon / star-field / Starbase textures fetch (theater is revealed when they are ready)
  • Play / pause, playback at 1×, 10×, 60×, 3600×, or 86400×, mission scrubber with phase marks + event ticks
  • Cinematic bookmarks — 0–9 seek that flight's timeline (T−5, pad, staging, and the later beats the trajectory actually has, through splashdown or the long coast)
  • Event ticks on the scrubber (liftoff, staging, translunar injection, lunar orbit insertion, touchdown) — click a tick to seek
  • Flight graphs (Tab) — altitude, ground speed, and acceleration for Starship and Super Heavy, with a playhead on the theater clock. The mission pauses while this dashboard is open
  • Ascent / return to launch site cross-section (Tab cycle or button) — true-scale black & white launch-plane diagram (Earth surface + 150 km atmosphere, booster path liftoff → chopsticks); mission clock keeps running
  • Earth great-circle section (Earth GC / Tab) — Flight 13: whole-Earth B&W slice on the Starbase–Gauteng corridor (Indian Ocean landing · Australia), also from the Flight 13 briefing. Flight 14: orbital-plane / Chile-west target view (no splash buoy) from the Flight 14 briefing.
  • Polar trajectories (Polar / Tab) — Earth-centric 2-D map looking along ecliptic +Z (perpendicular to Earth's orbital plane): ship path + Moon path, true scale
  • Help (H) and KeyMap (K or button) — the theater pauses while either is open, and while the flight graphs are open. Tab cycles the dashboards and does not open the KeyMap. The KeyMap is a white-outline keyboard on black with the action under each key
  • Landing beat on terminal complete (camera settle + 1× hold, then mission-complete card); theater site Malapert Massif (south pole)
  • Mission-complete card
  • Cameras: Auto-cam (toggle \; Flight 13 follows the official webcast left-pane cuts only) · Free rail (☀️🌍🌙 🚀 Booster, 🏗️ Launch Tower, 🚢 Starship — pan / orbit / zoom; picking one turns Auto-cam off) · Fixed rail (livestream mounts such as Launchpad Drone, Ground Camera One, Tower One / Tower Two peak cams, fin / hull / engine-bay, Drone recovery — movement locked, with a notice if you try) · [ / ] cycle cameras · − slower · + faster · C/V roll · T/B pan up/down on Free pad cameras (Earth-perpendicular at the launch tower)
  • HUD chrome — left telemetry, right camera buttons, bottom scrubber — opens with Menu (M) and the theater pauses while that page is up. Go to Mission Menu on that page leaves the flight. Auto-cam (default, \) keeps the webcast bottom bar on the live view (engine cluster, attitude, milestone line, T+ clock, speed and altitude dials).
  • Menu (M): that chrome plus full telemetry; Flight 13 also shows Force check (n-body vs Earth-only coast |Δr|)
  • Logarithmic depth buffer for near craft + far Moon

Develop

npm install
npm run precompute   # regenerate trajectory JSON (also runs before build)
npm run dev
npm test             # unit + baked-trajectory invariants (node:test via tsx)
npm run lint         # ESLint (src/ + scripts/)
npm run typecheck
npm run ci           # typecheck + lint + test
npm run build        # precompute (with invariant check) → typecheck → vite
npm run preview

Tests cover Kepler helpers, propellant bookkeeping, mission clock/timeline, epoch calendar helpers, Earth-frame geometry, capture period helpers, vec3, and structural invariants on src/data/trajectory.json (phase order, fuel monotonicity, no trail teleport jumps) plus synthetic failure cases. Precompute re-runs those invariants so a bad pack fails the build. Linting uses ESLint flat config (eslint.config.js) with typescript-eslint.

Runtime recompute (slow, for physics debugging): open the site with ?recompute=1.

Browser agents (Chrome DevTools MCP / CDP): docs/AGENT_BROWSER.md — window.__theater snapshot/seek/camera pose, plus scripts/theater-devtools.sh.

Base path is /tothemoon/ (GitHub project Pages).

Roadmap

Recommended next work (prioritized): docs/NEXT.md.
Visual realism backlog (for agents): docs/VISUAL_REALISM.md (V0–V28 shipped; V29–V47 queued).
Starship + Starbase hardware (public vs theater): docs/STARSHIP.md. Flight 13 recap / webcast SOP: docs/STARSHIP_13.md. Flight 14 orbital test: docs/STARSHIP_14.md.

Deploy

Pushes to main deploy via .github/workflows/pages.yml.

Stack

License

MIT — see LICENSE.

Contributors

Languages