{
const svg = d3.select(DOM.svg(svgWidth, svgHeight));
const g = svg.append("g").attr("transform", `translate(${svgWidth / 2},${svgHeight / 2})`);
const path = g.append("path")
.attr("fill", d3.schemeCategory10[1])
.attr("d", arc({ startAngle: 0, endAngle: computeAngle(value) }));
let counter = 0;
function _loop() {
counter += 1;
let fromValue = 0;
let toValue = 0;
if (counter % 2 === 0) {
fromValue = 0;
toValue = value;
} else {
fromValue = value;
toValue = 0;
}
path.transition()
.delay(transitionDelay)
.duration(transitionDuration)
.attrTween("d", () => {
return (time) => {
const timeValue = d3.interpolate(fromValue, toValue)(time);
const timeAngle = computeAngle(timeValue);
return arc({ startAngle: 0, endAngle: timeAngle });
}
})
.on("end", _loop);
}
_loop();
return svg.node();
}