Last active
October 20, 2024 21:55
-
-
Save jsomers/18b928aee211ed7249f5707be89f79f0 to your computer and use it in GitHub Desktop.
Dynamically created sky map using Fourmilab's Your Sky
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
var toUrlParam = function(date) { | |
return date.toISOString().split("T")[0].replaceAll("-", "%2F"); | |
} | |
// https://stackoverflow.com/questions/563406/add-days-to-javascript-date | |
Date.prototype.addDays = function(days) { | |
var date = new Date(this.valueOf()); | |
date.setDate(date.getDate() + days); | |
return date; | |
} | |
var date = new Date("1576-11-01"); | |
var imgTag; | |
var updateImage = function() { | |
date = date.addDays(1); | |
imgTag.src = `https://www.fourmilab.ch/cgi-bin/Yoursky?date=1&utc=${toUrlParam(date)}+12%3A42%3A40&jd=2450851.02963&lat=56.0881&ns=North&lon=13.2322&ew=East&coords=on&moonp=on&deepm=2.5&limag=5.5&starnm=2.0&starbm=2.5&imgsize=640&dynimg=y&fontscale=0.75&scheme=1&elements=`; | |
} | |
document.addEventListener("DOMContentLoaded", function() { | |
imgTag = document.createElement("img") | |
updateImage() | |
document.querySelector("body").appendChild(imgTag); | |
setInterval(updateImage, 150); | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I made the GIF that appears on https://observablehq.com/d/1838567c160ca917 by opening the above html page in a browser and taking a short screencap.