Archive: Loop an animated gif


Loop an animated gif
Hi guys

I'm using AnimGif to display a gif on a custom page - no problems. I have a function to start and stop it.

However, could someone please tell me how to loop the animation as it just plays once then stops.

There doesn't seem to be any help in the plugin examples files.

Thanks


From AnimGIF's description, it sounds like it should display the GIF in an infinite loop until you stop it. Are you sure the GIF itself is built this way? What happens when you display it in a browser?


That's a really good point kichik, and no I hadn't even tested that. However the gif does actually loop in a browser, so I'm still stumped as to how we loop an animated gif.

Anyone.....??


Show me that gif


If I remember correctly there should be a 'loop' flag in the header of the GIF file itself, which turns it on/off. You could try using something like GIF Construction Set to set the loop flag.
CF

[Edit] Oups, just saw the second post ... My bad, I didn't realize that it does loop in a browser. The only other thing I can suggest is to check the number of iterations set for the animation, it may be that the plugin does not like both the loop flag on and a number of iterations >0 ?


Looks like plug-in not extracts 'loops' parameter from GIF header. For now just add at the end of play() function in the animgif.cpp file (line ~246):


lpWndProcOld = (void *)SetWindowLong(childwnd, GWL_WNDPROC, (long)WndProc);
+ imgset.nLoops = 1;
anim.Play (childwnd, r, &imgset, trCol);