chart = {
const svg = d3.create("svg")
.attr("viewBox", [0, 0, width , height])
.attr("fill", "none")
.attr("stroke", "currentColor");
applyPencilFilterTextures(svg);
const outline = svg.append("path")
.attr("fill","white")
.attr("id","earth")
const grid = svg.append("path")
.attr("stroke-width","0.5px")
.attr("stroke","#eee")
.attr("filter", "url(#pencilTexture4");
const feature = svg.append("path")
.attr("stroke-width", "3px")
.attr("fill","#eeeeee")
.attr("filter", "url(#pencilTexture3");
const linebox = svg.append("g").attr("id","lineBox");
const lines = linebox.selectAll(".lines")
.data(linesRaw.features.reverse())
.join("path")
.attr("class",d => `lines ${d.properties.class}`)
.attr("stroke","#0789ad");
function render() {
grid.attr("d", path(graticule));
outline.attr("d", path(sphere));
feature.attr("d", path(land));
lines.attr("d", d => path2(d))
}
let p1, p2 = [0, 0], r1, r2 = [0, 0, 0];
let z1, z2 = 400;
function update(e) {
let item = arbitraryPoints.find(o => o.trigger == e)
p1 = p2, p2 = [item.lon,item.lat];
z1 = z2, z2 = item.zoom;
r1 = r2, r2 = [-p2[0], tilt - p2[1], 0];
const ip = d3.geoInterpolate(p1, p2);
const iv = Versor.interpolateAngles(r1, r2);
const zoomer = (t) => {return z1 + (z2-z1)*t};
d3.transition()
.duration(1250)
.tween("render", () => t => {
projection.scale(zoomer(t));
projection.rotate(iv(t));
render();
})
.transition()
.tween("render", () => t => {
render();
})
.end();
return e;
}
update();
return Object.assign(svg.node(), {update});
}