JSFiddle - React, Tailwind, and code Playground
by chim
JavaScript
//Manage the image swapping and execute the fading
var fadeEffect = function() {
return{
init:function(start, end, cb) {
this.current = start;
this.callback = cb;
this.start = start;
this.end = end;
this.si = setInterval(function(){fadeEffect.tween()}, 20);
},
tween:function() {
if(this.current == this.end) {
clearInterval(this.si);
this.callback("callback?");
}else{
document.body.innerHTML = this.current
this.current -= 1;
}
}
}
}();
function slideshowGo(imgs,next) {
fadeEffect.init(100,0,function(x) {
alert(x);
});
}
slideshowGo()