slight delay in animated gif loop

Jim MacConnell jmac at consensustech.com
Mon Sep 20 12:13:51 EDT 2004


I'm surprised it makes a noticeable difference but...  resetting your frame
to the start is using an added IF statement. Maybe try using MOD instead.
This means the same number of statements are executed every time through the
loop so the timing should be better.

Also note I added a tNumFrames variable so the routine will work for any
animated gif. Just replace the 36 with the correct number and off you go.


----------------

put the currentFrame of image "imgSpinner" into tCurrentFreim
put 1 into tEnough
---------- Added line ----------
put 36 into tNumFrames
------------------------------

repeat until the mouse is up
play "ding.wav"
wait 80 milliseconds
---------- New lines start ----------
add 1 to tCurrentFreim
set the currentFrame of image "imgSpinner" to tCurrentFreim mod tNumFrames
if tCurrentFreim > 95 then send mouseUp to me
---------- New lines end ----------
end repeat

----------------

Hope this helps (and was right... I'm still learning)

-- 
Jim M

> From: "kweto" <nrkweto03 at hotmail.com>
> Reply-To: How to use Revolution <use-revolution at lists.runrev.com>
> Date: Mon, 20 Sep 2004 17:38:17 +0900
> To: "How to use Revolution" <use-revolution at lists.runrev.com>
> Subject: slight delay in animated gif loop
> 
> My only guesses as to why are that (1) either the "repeat... if" control
> structure requires a bit more processing time, or (2) I have neglected to
> set some image property I am not aware of. (Incidentally, the gif plays
> smoothly when tested on a browser.)
> 
> Here's the bit of script:
> 
> put the currentFrame of image "imgSpinner" into tCurrentFreim
> put 1 into tEnough
> repeat until the mouse is up
> play "ding.wav"
> wait 80 milliseconds
> -- long enough for the soundfile to play (and, yes
> -- I tried "wait until the sound is done" but yuch!)
> if tCurrentFreim > 35 then put 0 into tCurrentFreim
> if tCurrentFreim < 37 then add 1 to tCurrentFreim
> set the currentFrame of image "imgSpinner" to tCurrentFreim
> add 1 to tEnough
> if tEnough > 95 then send mouseUp to me
> end repeat
> ----------------



More information about the use-livecode mailing list