JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container">
<div class="child progress"></div>
<div class="child shrinker timelapse"></div>
</div>
CSS
#container {
width: 800px;
height: 60px;
margin: 0 auto;
position: relative;
top: 50px;
transform: translateY(-50%);
border-radius: 35px;
overflow: hidden;
}
.child {
width: 100%;
height: 100%;
}
.progress {
color: white;
text-align: center;
line-height: 75px;
font-size: 35px;
font-family: "Segoe UI";
animation-direction: reverse;
background: #e5405e;
/* Old browsers */
background: -moz-linear-gradient(left, #e5405e 0%, #ffdb3a 25%, #3fffa2 50%, #3fffa2 50%, #1a9be0 73%, #ba68ed 100%);
/* FF3.6-15 */
background: -webkit-linear-gradient(left, #e5405e 0%, #ffdb3a 25%, #3fffa2 50%, #3fffa2 50%, #1a9be0 73%, #ba68ed 100%);
/* Chrome10-25,Safari5.1-6 */
background: linear-gradient(to right, #e5405e 0%, #ffdb3a 25%, #3fffa2 50%, #3fffa2 50%, #1a9be0 73%, #ba68ed 100%);
}
.shrinker {
background-color: black;
position: absolute;
top: 0;
right: 0;
width: 100%;
}
.timelapse {
animation-name: timelapse;
animation-fill-mode: forwards;
animation-duration: 5s;
animation-timing-function: cubic-bezier(.86, .05, .4, .96);
}
@keyframes timelapse {
0% {
width: 100%;
}
100% {
width: 0%;
}
}