JSFiddle - React, Tailwind, and code Playground
HTML
<div id="goflash">goflash</div>
CSS
@-webkit-keyframes flash-red {
50% {
background: #f00;
}
}
.anm-flash {
-webkit-animation-name: flash-red;
-webkit-animation-duration: .5s;
background: rgba(255, 0, 0, 0);
width: 160px;
height: 100px;
}
JavaScript
var gf = document.querySelector("#goflash"),
animationDuration = '1s'
gf.classList.remove("anm-flash");
setTimeout(function() {
gf.classList.add("anm-flash");
gf.style["-webkit-animation-duration"] = animationDuration;
}, 1000);