While working with animations, I came across an undocumented and unexpected behavior:
When chaining animations using transform (any transform property, and only the transform property), the first animation will have the expected behavior of transitioning from state A to state B, while the second will just go from B to C without any transition.
div {
background:red;
width:100px;
height:100px;
-webkit-animation: in 2s, out 2s 3s forwards;
animation: in 2s, out 3s 2s forwards;
}
@keyframes in {
from {
transform: scale(0);
}
to {
transform: scale(1);
}
}
@keyframes out {
from {
transform: scale(1);
}
to {
transform: scale(.5);
}
}
@-webkit-keyframes in {
from {
-webkit-transform: scale(0);
}
to {
-webkit-transform: scale(1);
}
}
@-webkit-keyframes out {
from {
-webkit-transform: scale(1);
}
to {
-webkit-transform: scale(.5);
}
}
<div></div>
I know in this particular case, things can be done in a single step, but that's not the solution I'm looking for
How can I solve this using CSS only?
UPDATE : Everything seems to work just fine in firefox, could it be a chrome bug?
UPDATE 2 : Added the prefix free animation as requested; Doesn't change much.