1

I've been searching all day to use gif image inside html5 canvas can't find a useful article in it,is there any way I could use gif image inside canvas. I'm in position to use a gif image inside a canvas but it doesn't changes it loads loads the first frame only and how to play the gif image completely or is there any way I could use gif formatted image inside a canvas.

some_other_guy
  • 3,364
  • 4
  • 37
  • 55
user2756921
  • 47
  • 2
  • 10
  • 1
    ["You cannot as canvas doesn't provide any methods to deal with animated gifs. You should split gif into single frames then create a spritesheet and animate it copying current frame."](http://stackoverflow.com/questions/9276594/how-to-play-gif-inside-canvas-in-html5) – epipav Jun 30 '14 at 11:34
  • thks man i am new to the concept canvas i don't know how to split gif into single frame and create a sprite sheet can u please explain it in detail – user2756921 Jun 30 '14 at 12:02
  • check [this](http://slbkbs.org/jsgif/) site which offers a good js gif player which you can include in your canvas – epipav Jun 30 '14 at 12:05

1 Answers1

0

Quote from jsgif: A GIF player in JavaScript

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 .

Maybe you would take a look in the jsgif source code to find some ideas

ale
  • 10,012
  • 5
  • 40
  • 49