0
大家好我正在開發Javascript Canvas項目,這裏有一小段代碼不起作用,我只是想用100個時間延時動畫一個一個的圖像,但是它動畫化所有圖像立刻。Javascript動畫圖像一個接一個
for (var i = 0; i < queueIdArr.length; i++){ // queueIdArr.length = 4
(function(i){
var animInterval = window.setInterval((function(i){
if (i == (queueIdArr.length - 1)){
animate(queueIdArr[i], {opacity: 0}, animationDuration, "delete"); // my own function, it works fine. animate (id, new_properties, duration, callback);
window.clearInterval(animInterval);
} else {
animate(queueIdArr[i], {opacity: 0}, animationDuration, "delete");
}
})(i), 100);
})(i);
}
謝謝你工作正常。 – Irakli