← everything I built

SpaceX Mars Transfer Simulation

live

Earth and Mars are only close enough for a trip every couple of years, and the route between them is a long curve rather than a straight line. This shows both. The planets move at their real speeds and distances, worked out from real orbital calculations rather than drawn by hand, so a launch only becomes possible when the two planets line up properly. You can speed the clock up or slow it down, zoom in and out, turn the orbit lines on and off, and click a planet to see where it is and how fast it is going. A log lists every launch, journey and arrival as they happen.

SpaceX Mars Transfer Simulation screenshot
SpaceX Mars Transfer Simulation screenshot
SpaceX Mars Transfer Simulation screenshot

what it does

  • The planets move at their true speeds and distances, so a launch only becomes possible when they line up, the same as in real life.
  • You can speed the clock up, slow it down, zoom in and out, and click a planet to see where it is and how fast it is going.
  • A log lists every launch, every journey and every arrival as they happen.
  • The planet surfaces are drawn by the page rather than photographed, and it works with a mouse or a finger.

Built with

HTML5 CanvasVanilla JavaScriptCSS3Orbital Mechanics

want the how and why?

I write up builds like this one. What I did, what went wrong, and what is worth copying.

Read the writing →