Hi All,
I hope I'm able to articulate what I want to achieve! I have a simplified version of a chart in the attached Codepen.
Whenever a 'slice' is clicked, I want it to spin anticlockwise to the 0 degree position. If it's already in the 0 degree position, nothing should happen. What I have so far is a CSS animation that rotates minus 72 degrees on every click which is the right animation, but I can't get the right rotation from any slice.
Basically, on load, if you clicked the yellow segment it would go nowhere. If you click the pink segment, it rotates to 0 (correct). But if you then clicked the yellow segment again, it should rotate a whole 288 degrees back to the origin.
I hope that makes sense and I haven't overcomplicated it!