Skip to content

Instantly share code, notes, and snippets.

@macressler
Forked from mikeweber/Description
Last active August 29, 2015 14:25
Show Gist options
  • Save macressler/4c733ad10f1bc4f1ce06 to your computer and use it in GitHub Desktop.
Save macressler/4c733ad10f1bc4f1ce06 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