.transitionLine {
width:300px;
height:100px;
background-image:
linear-gradient(#ef4e4e,#ef4e4e),
linear-gradient(#ef4e4e,#ef4e4e),
linear-gradient(#ef4e4e,#ef4e4e),
linear-gradient(#ef4e4e,#ef4e4e),
linear-gradient(#ef4e4e,#ef4e4e);
background-size:
5px 0%,
0% 5px,
5px 0%,
0% 5px,
5px 0%;
background-position:
bottom left,
top left,
top center,
150px 100%,
right bottom;
background-repeat:no-repeat;
animation: increase 3s;
animation-fill-mode: forwards;
}
@keyframes increase {
20% {
background-size:
5px 100%,
0% 5px,
5px 0%,
0% 5px,
5px 0%;
}
40% {
background-size:
5px 100%,
50% 5px,
5px 0%,
0% 5px,
5px 0%;
}
60% {
background-size:
5px 100%,
50% 5px,
5px 100%,
0% 5px,
5px 0%;
}
80% {
background-size:
5px 100%,
50% 5px,
5px 100%,
50% 5px,
5px 0%;
}
100% {
background-size:
5px 100%,
50% 5px,
5px 100%,
50% 5px,
5px 100%;
}
}
<div class="transitionLine"></div>