Old 26th October 2007, 18:20   #1
Junior Member
Join Date: Oct 2007
Posts: 5
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.

sharkystar is offline   Reply With Quote
Old 26th October 2007, 19:01   #2
[NSIS Dev, Mod]
kichik's Avatar
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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?

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 26th October 2007, 23:09   #3
Junior Member
Join Date: Oct 2007
Posts: 5
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.

sharkystar is offline   Reply With Quote
Old 27th October 2007, 11:27   #4
Senior Member
pospec's Avatar
Join Date: Jun 2007
Location: Otrokovice, Czech Republic
Posts: 308
Show me that gif
pospec is offline   Reply With Quote
Old 28th October 2007, 12:33   #5
Senior Member
Join Date: Apr 2006
Posts: 289
Send a message via ICQ to CancerFace
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.

[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 ?
CancerFace is offline   Reply With Quote
Old 29th October 2007, 06:18   #6
Major Dude
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
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);

Takhir is offline   Reply With Quote
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump