Last active
December 15, 2015 03:19
-
-
Save yusugomori/5193874 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var animate = function($img, imgs, i, refreshRate){ | |
if(i >= imgs.length) return; | |
setTimeout(function() { | |
$img.attr('src', imgs[i]); // 画像の切り替え | |
animate($img, imgs, i+1, refreshRate); // 次のコマ画像へ | |
}, refreshRate); // 画像の更新間隔 | |
}; | |
var $img = $('#img'); | |
var imgs = []; | |
for(var i=0; i<100; i++) imgs.push('/path/to/imgs/'+i+'.png'); // コマ画像のパス | |
var refreshRate = 200; | |
animate($img, imgs, 0, refreshRate); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment