Public
Edited
Mar 13, 2023
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
hours
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
hours = (await FileAttachment("mooninfo_2023.json").json()).map((d, i) =>
Object.defineProperties(d, {
i: { value: i },
t: { value: parse(d.time) }
})
)
Insert cell
videoTime = orbit.currentTime = moon.currentTime = (hour.i / (hours.length - 1)) * duration
Insert cell
duration = Generators.observe((change) => {
const inputted = () => change(moon.duration);
moon.pause();
moon.addEventListener("loadedmetadata", inputted);
change(moon.duration || 292);
return () => moon.removeEventListener("loadedmetadata", inputted);
})
Insert cell
moon = combined.querySelector("video.moon")
Insert cell
orbit = combined.querySelector("video.orbit")
Insert cell
parse = d3.utcParse("%d %b %Y %H:%M UT")
Insert cell
<style>
form button {
width: 55px !important;
}
input[name=i] {
width: ${width - 220}px !important;
}
.combined {
position: relative;
}
.orbit {
position: absolute;
left: 10px;
top: 10px;
width: ${width / 350 * 60}px;
height: ${width / 350 * 60}px;
}
</style>
Insert cell
import { Scrubber } from "@mbostock/scrubber"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more