Animated GIF in HTML5 canvas

julio picture julio · Jun 17, 2010 · Viewed 96.1k times · Source

In HTML5, how can I draw easily (no too much complex code please) an animated GIF in a canvas that works (with drawImage only first frame is shown in the canvas)

Answer

rodrigob picture rodrigob · May 16, 2011

I believe you are looking for http://slbkbs.org/jsgif

Unfortunately, the DOM doesn't expose individual frames of a GIF, so this is done by downloading the GIF (with XMLHttpRequest), parsing it, and drawing it on a <canvas>.