JSFiddle - React, Tailwind, and code Playground
HTML
<div id="ball"></div>
CSS
#ball {
position:absolute;
left:0px;
top:0px;
width:247px;
height:266px;
display:none;
background-repeat:no-repeat;
}
JavaScript
var imgc = 0;
var images = ["http://s11.postimg.org/8iznatxr3/image.png",
"http://s11.postimg.org/g08uq1na7/image.png",
"http://s11.postimg.org/hgkd86q73/image.png",
"http://s11.postimg.org/5fyx7gisf/image.png",
"http://s11.postimg.org/3pfw5z19b/image.png"];
$(document).click(function (e) {
$("#ball").html("<img src='" +images[0] +"'>").show()
setInterval(setImage, 300);
});
function setImage() {
var next=new Image()
images.push(images.shift())
next.onload=function(){
$("#ball img").attr("src", this.src)
}
next.src= images[0]
}