Glad you enjoyed that example. :)
> Has it ever been considered to add some of the more useful and
> generalized tweens into d3 itself?
Maybe. I think the challenge is designing the API so that it strikes
the right balance between convenience and generality. Is this
something that will be used often? When it is used, does it
significantly make your life easier? How complicated is this feature
to implement, test and explain? In other words, is the power-to-weight
ratio high enough to justify inclusion in the core API, or is this
better suited as a plugin or example?
It'd be possible to interpolate paths this way automatically by
extending d3_interpolateByName to return this special interpolate for
"d" attributes:
https://github.com/mbostock/d3/blob/3.0/src/core/interpolate.js#L249
But I'm pretty sure we don't want to do this because it's probably
slower than the current string interpolator for paths, and also might
introduce undesired artifacts in the common case where the start and
end path do have the same number of control points. So I think it's
probably best suited as something you'd use with attrTween to override
the default interpolator, though I could see refactoring the example
to make it a bit more general, say by defining an interpolatePath(a,
b) method that creates off-screen path elements rather than relying on
cloneNode.
Mike