Quantcast
Channel: Foren
Viewing all articles
Browse latest Browse all 170

How can I get a .gif to animate with HTML 5?

$
0
0

I used this function to put BE4.gif on the canvas but it doesn't animate and only shows the first frame of the .gif (it's an animated .gif, of course).

function func(){ var ImageCanvas=document.getElementById("canvas1");
if(!ImageCanvas.getContext){return;}
var context=ImageCanvas.getContext("2d");
var imgDraw=new Image();
imgDraw.onload=function(){context.drawImage(imgDraw,0,0);};
imgDraw.src="BE4.gif";
}

What can I do?


Viewing all articles
Browse latest Browse all 170

Trending Articles