I just play with this demo and recreate it myself: http://bl.ocks.org/mbostock/5100636
I can define a new endAngle and it will animate just fine, but now I'm trying to animate startAngle. I just can't get it to work.
function animateArc(newStart, newEnd) {
myArc.transition().duration(750).call(arcTween, newStart, newEnd);
function arcTween(transition, newStart, newEnd) {
transition.attrTween("d", function(d) {
var interpolateStart = d3.interpolate(d.startAngle, startAngle);
var interpolateEnd = d3.interpolate(d.endAngle, endAngle);
return function(t) {
d.startAngle = interpolateStart(t);
d.endAngle = interpolateEnd(t);
return arc(d);
};
});
}
}
I get no errors and endAngle is still animating, but the startAngle code I added is literally just ignored.
What is the correct way to tween startAngle?
source
share