JSFiddle - React, Tailwind, and code Playground
by johnwun
HTML
<div id="bar"></div>
CSS
#bar {
height: 10px;
width: 0;
background-color: blue;
}
JavaScript
var max_width = 250,
step = 0,
speed = 0.10; // 10% speed
function animate() {
$('#bar').width( (Math.sin(step++*speed)+1)/2*max_width );
}
setInterval( animate, 50 );