Implementing arc transition
One area where arc differs significantly from other shapes, such as line and area, is its transition. For most of the shapes we covered so far, including simple SVG built-in shapes, you can rely on D3 transition and interpolation to handle their animation. However, this is not the case when dealing with arc. We will explore the arc transition technique in this recipe.
Getting Ready
Open your local copy of the following file in your web browser:
https://github.com/NickQiZhu/d3-cookbook/blob/master/src/chapter7/arc-transition.html
How to do it...
In this recipe, we will animate a multi-slice annulus transitioning each slice starting from angle 0
to its final desired angle and eventually reaching a full annulus:
<script type="text/javascript"> var width = 400, height = 400, endAngle = 2 * Math.PI, colors = d3.scale.category20c(); var svg = d3.select("body").append("svg") .attr("class", "pie") .attr("height", height) ...