chart = {
replay;
const svg = d3.create("svg")
.attr("viewBox", [-width / 2, -height / 2, width, height])
.style("background", "#333")
.attr("stroke", "currentColor")
.attr("stroke-width", 1.5);
svg.selectAll("circle")
.data(circles)
.join("circle")
.attr("fill", d => color(d.angle = Math.atan2(d.y, d.x)))
.attr("cx", d => Math.cos(d.angle) * (size / Math.SQRT2 + 30))
.attr("cy", d => Math.sin(d.angle) * (size / Math.SQRT2 + 30))
.attr("r", d => d.r - 0.25)
.transition()
.ease(d3.easeCubicOut)
.delay(d => Math.sqrt(d.x * d.x + d.y * d.y) * 10)
.duration(1000)
.attr("cx", d => d.x)
.attr("cy", d => d.y);
return svg.node();
}