slight delay in animated gif loop

kweto nrkweto03 at hotmail.com
Mon Sep 20 04:38:17 EDT 2004


Hello,

Actually, my animated gif's looping is not "natural", i.e., I don't rely on
"set repeatCount to -1". Instead, I use a "repeat" control strutcture to
progress the gif frame by frame, plus a two-part "if" statement to set the
currentFrame number of the gif back to 1 after its last frame has played.
The time between each frame is 80 milliseconds, during which time a 50
millisecond (or thereabouts) sound file plays.

The problem is that the time length of all the frame changes move (and
sound) uniformly, except, that is, for the change from the last frame back
to the first frame, which shows a very slight but nonetheless noticeable
time delay compared to the others.

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
----------------

If someone has a solution, neurotic-I would really appreciate hearing it.

Thanks.

Cheers,
Nicolas Cueto
(in somewhat less muggy Japan)


More information about the use-livecode mailing list