animated gifs

Scott Rossi scott at tactilemedia.com
Tue Mar 16 02:56:04 EST 2004


On 3/15/04 10:51 PM, "Andrew" <alw918 at earthlink.net> wrote:

> 1. How do I stop a gif on a given frame? (such as when a button is
> pressed)

 if the currentFrame of img myGif = 5 then \
   set the repeatCount of img myGif to 0

Of course, if the GIF is on frame 13 and you press the button, nothing will
happen.  To make sure the animation stops regardless of when the button is
pressed, you'd have to set up a repeat loop that repeatedly tests the GIF's
currentFrame.


> 2. How do I flip a gif horizontally without losing the frame sequence?

I don't believe you can flip an animated GIF and keep the frames intact (but
perhaps someone else knows different).  You may need to create a separate
flipped version in an image editor.


> 3. How do I hide a currently playing gif and show a different gif,
> starting on a particular frame of the new gif?

Store the GIFs off screen and display them as icons of a button:

 set the icon of btn myBtn to id of img myGif1

 [use the above test in a repeat loop]
 if the currentFrame of img myGif1 = 5 then
   set the repeatCount of img myGif2 to 0
   set the currentFrame of img myGif2 to 5
   set the icon of btn myBtn to id of img myGif2
   set the repeatCount of img myGif2 to -1
 end if


> (Are gifs still running even if they are hidden?

A quick test seems to indicate they don't continue running (I didn't know
that).


> Does this consume memory?)

Unless your GIFs are huge, it's not really memory that is impacted by the
presence of an animated GIF in and of itself (memory is affected by
everything present in the stack, since the entire stack is loaded into RAM
at startup).  Rather, the use of processing power can be affected by
animated GIFs.  If you take some running animated GIFs and hide them, you
should see processor use drop.  On the other hand, if your GIFs are large, a
stack with hidden GIFs may indeed require less RAM since hidden images are
not decompressed until they are shown on a card (see the bufferHiddenImages
property).

The RunRev guys may have a more complete answer...

Regards,

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



More information about the use-livecode mailing list