It may just be a bug with rotation transformations, which I will consider after some background.
Background
First, the way rotations should work is related to the circle. If you specify a few degrees, this will place the element in a position dictated by how many degrees the degrees specify. If not rotation animation, there are many ways to represent the placement of an element. The Uniquely code is half correct in its comment that the placement of 357 degrees and -3 degrees is the same, but they are very different when animated. A transition from 0 degrees to -3 degrees is a small counterclockwise rotation, while a transition from 0 degrees to 357 degrees is a large clockwise rotation.
conclusions
What you found seems to ignore this calculation (both in Firefox and Chrome from what I tested). From what I see, the union of rotate transforms effectively changes the direction of rotation, even if you combine with 0deg rotation:
transform: rotate(90deg); //rotates clockwise transform: rotate(0deg) rotate(90deg); //rotates counter-clockwise
It seems that you can fix this by "combining" rotation transformations into both stages of the animation:
// this performs a clockwise rotation @keyframes test3 { 0% { transform: rotate(0deg) rotate(90deg); } 100% { transform: rotate(0deg) rotate(357deg); } }
Finally, it seems that the number of โcombinationsโ matters. If you combine 2 turns in one step, but 3 in another, unexpected behavior will occur:
Conclusion
This is probably not the best answer, but the combination of such turns is simply not documented anywhere. I would suggest not combining the same rotate transforms (you can still combine rotateX and rotateY without this oddity) and stick to the sum of the degree values.
In the event that anyone finds this explanation, they may find out more about this behavior than I do, here is a fiddle with the above examples as a starting point.
source share