它不工作:
var ctx=document.getElementById("mycanvas").getContext('2d');
var image = new Image();
var firtImg=1;
var lastImg=75;
window.requestAnimFrame = (function(callback)
{
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function(callback)
{
window.setTimeout(callback, 1000 / 60);
};
}
)();
function draw(){
//loop here for loading system
if(firstImg< lastImg){
image.src = 'iglesiafls'+(firstImg++)+'.png';
ctx.drawImage(image,0,0,550,800,0,0,550,800);
requestAnimFrame(draw);
render();
}
}
我正在尝试使用画布实现 75 个图像的逐帧动画。