JSFiddle - React, Tailwind, and code Playground

by Ekus

HTML

<div id="spinner"></div>

CSS

#spinner {
    width:15px;
    height:15px;
    background-image: url('http://i.imgur.com/Rclk1Sf.png');
}

JavaScript

var counter = 0;
setInterval(function() {
    var frames=12; var frameWidth = 15;
    var offset=counter * -frameWidth;
    document.getElementById("spinner").style.backgroundPosition=
        offset + "px" + " " + 0 + "px";
    counter++; if (counter>=frames) counter =0;
}, 100);