JSFiddle - React, Tailwind, and code Playground
HTML
<div class="box1">
<img src="#" alt="testing1" class="chart1" />
</div><!-- / .box1 -->
<div class="box2">
<img src="#" alt="testing2" class="chart2" />
</div><!-- / .box2 -->
CSS
@-webkit-keyframes chart1 {
0%, 100% { width: 0px; }
50% { width: 50px; }
}
@-webkit-keyframes chart2 {
0%, 100% { -webkit-transform: scaleX(0); }
50% { -webkit-transform: scaleX(1); }
}
.box1, .box2 {
position: absolute;
top: 0; left: 0;
background: blue;
height: 50px;
width: 50px;
overflow: hidden;
-webkit-transform-origin: 0 0;
}
.box1 img {
position: absolute;
top: 0; left: 0;
width: 50px;
}
.box1 img, .box2 img { background: red; }
.box1 { -webkit-animation: chart1 2s infinite; }
.box2 {
left: 100px;
-webkit-animation: chart2 2s infinite;
}