Skip to main content
100%

Text on simple Arc

✓ Published0🌍 Public
TThanaporn-sk
Last edited Aug 18, 2016
Created on Aug 18, 2016

This example demonstrates that text placed along a path can smoothly transition between different arc geometries using D3.js's standard transition mechanism. It shows a repeating animation where the arc's endpoints and radius change, causing the text "Yay, my text is moving back & forth" to follow the newly defined path each time. The visualization relies on SVG's `<textPath>` element, linked to a `<path>` via the `xlink:href` attribute, and uses D3's `.attr("d", ...)` with `.transition().duration()` to animate the path data. The code also references D3 transitions with the `.each("end", repeat)` callback to loop the animation indefinitely.

AI-generated description

This is an example from my blog on Placing Texts on Arcs with D3.js that shows that a transition between similar paths (two arcs in this case) can be accomplished by the standard .transition().duration()

Another version shows how to transition between more complex paths

Other examples of text along a path from the same blog

forked from <a href='http://bl.ocks.org/nbremer/'>nbremer</a>'s block: <a href='http://bl.ocks.org/nbremer/bf3d285e48189507e0ea'>Text on an Arc - Animate from Arc to an Arc</a>

Similar vizzes