block by mbostock 3305854

Custom Tweens

Full Screen

Use transition.attrTween to customize interpolation during a transition. For example, the default transform interpolation from “rotate(0)” to “rotate(720)” has no effect because 0º and 720º are equivalent; by changing the interpolator to d3.interpolateString, you can animate the rotation.

symbol.transition()
    .attrTween("transform", function() {
      return d3.interpolateString("rotate(0)", "rotate(720)");
    });

index.html