Public
Edited
Dec 20, 2022
7 forks
6 stars
Insert cell
Insert cell
chart = {
const width = 960;
const height = 960;
const speed = 0.004;
const sphere = {type: "Sphere"};
const graticule = d3.geoGraticule10();
const context = DOM.context2d(width, height);
const projection = d3.geoOrthographic().fitExtent([[4, 4], [width - 4, height - 4]], sphere);
const path = d3.geoPath(projection, context);
while (true) {
projection.rotate([speed * performance.now(), -15]);
context.clearRect(0, 0, width, height);
context.save();
context.beginPath();
projection.precision(0);
path(ocean);
context.globalAlpha = 0.5;
context.fillStyle = "steelblue";
context.fill();
context.beginPath();
projection.precision(0.5);
path(graticule);
context.globalAlpha = 0.5;
context.strokeStyle = "#fff";
context.stroke();
context.beginPath();
path(sphere);
context.lineWidth = 2;
context.strokeStyle = "#000";
context.stroke();
context.restore();
yield context.canvas;
}
}
Insert cell
Insert cell
ocean = topojson.feature(topology, topology.objects.ocean)
Insert cell
topology = FileAttachment("ocean-110m.json").json()
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