JSFiddle - React, Tailwind, and code Playground
HTML
<div class="mydiv"></div>
<button id="speedup">
Speed up
</button>
CSS
@keyframes ticker {
0% {left: 0;}
50% {left: 100%;}
100% {left: 0;}
}
.mydiv {
width: 50px;
height: 50px;
background: blue;
position: fixed;
top: 20px;
animation: ticker 2000ms linear 0s infinite normal none running;
}
#speedup{
}
JavaScript
$('#speedup').click(function(){
var mydiv = $( ".mydiv" );
var val = mydiv.css('animation-duration');
var newVal = (parseFloat(val).toFixed(2) * 1000);
mydiv.css({"animation-duration" : newVal - 200 + "ms"});
});