JSFiddle - React, Tailwind, and code Playground
HTML
<div id="redDiv"></div>
CSS
#redDiv{
height:400px;
width:400px;
background:red;
}
JavaScript
$(document).ready(function(){
i = 1;
x = setInterval(function(){
$("#redDiv").css('opacity',1/i);
i++;
if(i==50){
i=0;
// clearInterval(x);
}
},60)
})