JSFiddle - React, Tailwind, and code Playground

HTML

<div id="whatever">Test</div>

CSS

.animated {
    color:blue;
}
.notAnimated {
    color:red;
}

JavaScript

function animateWithDelay() {
    var animatedEl = document.getElementById('whatever');
    animatedEl.className = 'notAnimated';
    setTimeout(function () {
        animatedEl.className = 'animated'
        setTimeout(animateWithDelay, 5000); // 5 second animation duration
    }, 1000) // delay 1 second
}

animateWithDelay()