loop_render = () => {
const svg = d3
.create("svg")
.attr("width", width)
.attr("height", height)
.style("text-anchor", "middle")
.style('font-family', 'sans-serif')
.style("font-size", "12px");
const rect = svg
.append("rect")
.attr("width", width)
.attr("height", height)
.style("fill", "white");
const paths = svg
.selectAll("path")
.data(projections, d => d.name)
.join("path")
.attr("d", d => {
const projection = d3
.geoProjection(d.value)
.fitExtent(
[[10, 10], [width, height]],
topojson.feature(shapefile, shapefile.objects.countries)
);
const path_d = d3.geoPath().projection(projection)(path_data);
return path_d;
})
.style("fill", "none")
.style("stroke-width", .1);
return t => {
const _t = t < .5 ? t * 2 : (1 - t) * 2;
paths.attr("stroke", (d, i) =>
(i + 1) / projections.length <= _t ? "black" : "white"
);
return svg.node();
};
}