Can I alter the frame rate of an animated GIF by script?

Scott Rossi scott at tactilemedia.com
Mon May 10 15:19:25 EDT 2004


Recently, "Graham Samuel"  wrote:

> I could reduce the number of animated GIFs in my app (which might be a
> cause of these difficulties) if I could change the frame rate of an
> animated GIF on the fly. So far I haven't found anything in the
> documentation about this: can anyone say if it's possible and if so, how to
> do it?

You can't change the frameRate but you don't need to rely on it either.  Set
the repeatCount of your GIF to 0 and increment the currentFrame via script.

[example card script]
 on playGIF
   get the currentFrame of img myGIF
   if it < the frameCount of img myGIF then
     put it+1 into F
   else put 1 into F
   set the currentFrame of img myGIF to F
   send "playGIF" to me in 100 milliseconds #10 FPS
 end playGIF

See the list archives for more on this technique.  A scripted solution gives
you much greater control over GIF playback than the built-in timing in
animated GIFs.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com



More information about the use-livecode mailing list