When is a GIF Finished Playing?
hh at livecode.org
Wed Feb 10 17:59:10 EST 2016
Scott R. wrote:
> -HH makes a good point that I forgot about: if you control the playback
> yourself, setting the GIF's currentFrame every so many millisecs, you'll
> always know which frame you're on in the GIF. This will work for most
> GIFs, but can mess up playback of GIFs that use varying frame delays since
> timing will differ from how the GIF was originally authored.
Let me add these considerations regarding 'frame delay' by DIY:
== Advantage: We can use the given times or adjust to current
'environment'on the fly if we control the animation by ourselves.
For example change the frame every *full next* 50 millisecs by
send "handler" to me in 50 millisecs - (the millisecs mod 50) millisecs
This holds the animation "in rhythm" and doesn't buffer and spit out
at once the 'waiting frames' -- as some browsers and GIF players do.
== I use to look at (and edit) frames delay with GraphicConverter.
As you say, most gifs (here 99%) use the same delay for all frames,
much too short for usage in HTML5 standalones.
== Regarding frame delays in general, especially usage of gifs in HTML5,
this will be a real ('cross-browser') problem:
"The problem seems to be that many browsers will ignore very short
per-frame delays and ***replace them with a default delay*** (often
0.1 secs). And the cutoff for what counts as a "very short" delay
varies between browsers: Firefox apparently accepts anything down
to 0.02 seconds per frame, while IE ignores delays below 0.06 seconds
[Source: seen at webmasters.stackexchange.com, stars set by me.]
More information about the Use-livecode