I have radios aligned on an arch.
I would like to add a transition that slides the selected inner blue dot along the arch to the newly selected radio.
I have a working demo setup. WORKING DEMO
I have radios aligned on an arch.
I would like to add a transition that slides the selected inner blue dot along the arch to the newly selected radio.
I have a working demo setup. WORKING DEMO
See a solution in the fiddle (click on the blue button):
Just put the button in a "g" and rotate it with transition:
const button = d3.select("#button");
let angle = 60;
button.on("click", () => {
angle = -angle;
button.transition().duration(1000).attr("transform", `translate(${cX}, ${cY}) rotate(${angle})`);
});
Another option is to use animateMotion along the path:
<svg width="300" height="200">
<path fill="none" stroke="blue" stroke-width="3"
d="M 20,20 A 100,100 0 0 0 220,20" />
<circle r="10" fill="white" stroke="blue" stroke-width="3">
<animateMotion dur="3s" repeatCount="indefinite"
path="M 20,20 A 100,100 0 0 0 220,20 A 100,100 1 1 1 20,20" />
</circle>
</svg>