var timer;
window.onload = function() {
document.getElementById("cymbal").onclick = function() {
startAnimation("cymbal", 13);
}
document.getElementById("drink").onclick = function(){
startAnimation("drink",80);
}
document.getElementById("eat").onclick = function(){
startAnimation("eat",39);
}
document.getElementById("fart").onclick = function(){
startAnimation("fart",27);
}
document.getElementById("pie").onclick = function(){
startAnimation("pie",23);
}
document.getElementById("scratch").onclick = function(){
startAnimation("scratch",55);
}
}
function startAnimation(name, count) {
clearInterval(timer);
var index = 0;
var img = document.getElementById("cat");
timer = setInterval(function() {
if(++index < count) {
img.src = getImageName(name, index);
} else {
clearInterval(timer);
}
}, 80)
}
function getImageName(name, index) {
return "img/Animations/" + name + "/" + name + "_" + getIndex(index) + ".jpg";
}
function getIndex(index) {
if(index < 10) {
return "0" + index;
} else {
return index;
}
}
*
回帖描述:*
链接类型:*
下载链接:*
描述:*
回帖描述:*
链接类型:*
阅读权限:*
下载链接:



聚优部落技术论坛 © 版权所有 鲁ICP备15007479号-6
Copyright(C)web.com, All Rights Reserved.
