All examples By author By category About

linnnes

Custom Tweens

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)");
    });

forked from mbostock's block: Custom Tweens