Custom Tweens
A single cross-shaped symbol, drawn with the SVG path API via `d3.svg.symbol`, rotates continuously in the center of the frame. The example demonstrates how a custom transition interpolator overrides default behavior: `transition.attrTween` combines `d3.interpolateString` to animate the transform attribute from "rotate(0)" to "rotate(720)", enabling a full double spin that the standard numeric interpolation would ignore. Each ten-second transition loops indefinitely through the `each` event, showcasing attribute tweening in a minimal SVG animation.
AI-generated descriptionUse 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)");
});