When is a GIF Finished Playing?
Ray
ray at linkit.com
Wed Feb 10 16:28:19 EST 2016
Hi Scott - In my case I let my users decide how many times the GIF
cycles, so it more than likely will be more than once through, but not
infinitely as in -1. I like your second option, below, but how are you
getting the GIF's frame delay? Did I miss that Livecode property somewhere?
On 2/10/2016 4:06 PM, Scott Rossi wrote:
> If you want the GIF to stop playing when it reaches the last frame, why
> wouldn't you set the repeatCount to 1?
>
> If your GIF can play multiple times through (repeatCount = -1), then I
> believe the only way you can track its frames is to poll it, with a
> frequency that slightly exceeds its frame delay. Try running a loop while
> the GIF is playing, maybe something like:
>
> # GIF WITH 10 MS FRAME DELAY
>
> on mouseUp
> set the repeatCount of img "myGif" to -1
> trackPlayback
> end mouseUp
>
> on trackPlayback
> if the currentFrame of img "myGif" > (the frameCount of img "myGif" - 1)
> then
> set the repeatCount of img "myGif" to 0
> set the currentFrame of img "myGif" to the frameCount of img "myGif"
> -- just to be sure
> exit trackPlayback
> end if
> send "trackPlayback" to me in 8 millisecs
> end trackPlayback
>
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
>
>
> On 2/10/16, 12:06 PM, "use-livecode on behalf of Ray"
> <use-livecode-bounces at lists.runrev.com on behalf of ray at linkit.com> wrote:
>
>> It would also be helpful if a message was sent each time a new frame is
>> displayed. We could trap for those messages, count them, and go from there.
>>
>> On 2/10/2016 2:48 PM, Sannyasin Brahmanathaswami wrote:
>>>
>>> I have a similar need.
>>>
>>> Seems we can set the repeatCount, but I don¹t see a way to test for
>>> ³currentLoop²
>>>
>>> Theoretically we need something like ‹ where I am making up an unknown prop
>>> called ³currentLoop":
>>>
>>> if (the currentFrame of img "myGif" = the frameCount of img ³myGif²) AND \
>>> (the currentLoop of img ³myGif" = the repeatCount of img ³myGif")
>>>
>>> then
>>>
>>> answer ³Ok I am indeed done²
>>>
>>> end if
>>>
>>> On February 10, 2016 at 9:29:57 AM, Ray
>>> (ray at linkit.com(mailto:ray at linkit.com)) wrote:
>>>
>>>> Thanks Scott, but if you've set the RepeatCount to more than 1 and it's
>>>> looping through the frames, twice for example, isn't there a possibility
>>>> you'll get the CurrentFrame the same as the FrameCount too early?
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list