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 that 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-v2/blob/master/src/chapter7/arc-transition.html
How to do it...
In this recipe, we will animate a multi-slice annulus transitioning with 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.scaleOrdinal(d3.schemeCategory20c); var svg = d3.select("body...