Here is what I want to do: I want to play an animation on a div which starts from width: 0 to width: 100vw, then back to 0 BUT when it goes back to width 0, and I want to animate from the left to right, like a "continous" animation, not a "reverse". Like in the middle of the animation you can see the div, but when it goes back to width 0, it should disappear from left to right ( like the way it started ). I don't know how to explain this better...
div {
position: fixed;
z-index: 100;
background: red;
width: 0;
height: 100vh;
top: 0;
left: 0;
animation: 1s in-out forwards;
}
@keyframes in-out {
0% {
width: 0;
}
50% {
width: 100vw;
}
100% {
width: 0;
/* but starting to "disappear" from left to right, just like the way it appears */
}
}
<div></div>