JSFiddle - React, Tailwind, and code Playground

HTML

<div id="Top"></div>

CSS

#Top {
    width: 100px;
    height: 100px;
    background-color: #EFEFEF;
    border: 1px #DDD solid;
    margin: 10px;
}

JavaScript

var rotate = function() {
  $("#Top")
    .delay(1000).queue(function() {
        $(this).css({
            "background-color": "red"
        });
        $(this).dequeue();
    })
    .delay(3000).queue(function() {
        $(this).css({
            "background-color": "green"
        });
        $(this).dequeue();
    })
    .delay(500).queue(function(next) {
        $(this).css({
            "background-color": "blue"
        });
        $(this).dequeue();
        next();
    })
    .queue(rotate);
};

rotate();