There is the code :
<body>
<div class="box"></div>
</body>
<style>
@keyframes over-and-back {
0% {
background-color: hsl(0, 50%, 50%);
}
50% {
transform: rotate(-15deg) translateY(200px);
}
100% {
background-color: hsl(270, 50%, 90%);
transform: rotate(0) translate(0);
}
}
.box {
width: 100px;
height: 100px;
background-color: green;
animation: over-and-back 3s linear 3;
}
</style>
I read that this happens because "the rotation takes place after the translation" and indeed when I reverse the order of the transforms it stops moving diagonally. But I would like to understand why.