Skip to content

Instantly share code, notes, and snippets.

@mikeweber
Created April 15, 2014 17:11
Show Gist options
  • Save mikeweber/10748594 to your computer and use it in GitHub Desktop.
Save mikeweber/10748594 to your computer and use it in GitHub Desktop.
Solar system tour at speed of light
Experience our solar system at the speed of light (it's not as exciting as it sounds)
Step 1) Visit http://joshworth.com/dev/pixelspace/pixelspace_solarsystem.html.
Step 2) Open the JS console and paste in the following code.
Step 3) Watch the solar system "fly" by (BTW it'll take more than 5 hours to get to Pluto)
var c = 299792458; var w = 3474800; var cw = c / w * 0.001; var running = true; var t1 = new Date(); var x = 0; function scrollAtC(t0) { t1 = new Date(); x = window.scrollX + (t1 - t0) * cw; window.scrollTo(x, 0); if (running) { setTimeout(function() { scrollAtC(t1) }, 17) } }; scrollAtC(new Date());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment