Hi,
I was surprised to see what happen with your code, because obj.attr({ transform: 'r45' }) is working (you even don't need to specify the center, it's correct by default), so I don't know why it would not work with the animate function.
I checked that it's not only for path: if you have a simple rectangle, we observe the same strange behaviour.
Unfortunately, I am not able to study for any bug in the snapsvg library, moreover to fix any.
However I tried successfully a basic javascript animation:
let cassetteTape = Snap('#cassette-tape');
let leftSpinner = cassetteTape.select('#left-spinner');
let animation
let anim_deg
let spinning = (obj, deg) => {
if (anim_deg < deg) {
anim_deg ++
obj.attr({ transform: 'r' + (anim_deg % 360) });
}
else {
//break as soon as the target angle is reached
anim_deg = 0
obj.attr({ transform: '' });
clearInterval(animation)
}
return;
}
let spin = () => {
anim_deg = 0
animation = window.setInterval( function() { spinning(leftSpinner , 410); } , 5);
}
You'll notice that I changed the initial element selection too, because it wasn't working for me and I didn't find Snap.select in the snapsvg documentation. I think my proposal is more classical.
I hope it helps. Have a nice day.
Regards,
Alain