When is a GIF Finished Playing?

BNig bernd.niggemann at uni-wh.de
Wed Feb 10 21:46:56 CET 2016


Hi Ray,

not pretty but seems to work:

----------------------------------------
local sGifName
local sLastFrame
local sRepeatTimesFrames
local sCount

on mouseUp 
   put "myGif" into sGifName
   put the currentFrame of img sGifName into sLastFrame
   put 7 into tRepeatCount
   put tRepeatCount * the frameCount of img sGifName into sRepeatTimesFrames
   put 0 into sCount
   put the milliseconds into sMS
   set the repeatCount of img sGifName to tRepeatCount
   send "checkGifAnimation" to me in 0 milliseconds
end mouseUp

on checkGifAnimation
   if "checkGifAnimation" is in the pendingMessages then exit
checkGifAnimation 
   if the optionKey is down then exit checkGifAnimation -- just a precaution
   put the currentFrame of img sGifName into tCurrFrame
   if tCurrFrame <> sLastFrame then
      add 1 to sCount
      put tCurrFrame into sLastFrame
      if sCount >= sRepeatTimesFrames then
         answer "Animation Stopped"
         exit checkGifAnimation
      end if
   end if
   send "checkGifAnimation" to me in 40 milliseconds -- 40 ms seems to be
plenty
end checkGifAnimation
----------------------------------------

Kind regards
Bernd



--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Motion-Graphic-in-LiveCode-tp4682250p4701009.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the use-livecode mailing list