Jump to content

[Solved] GIF blinks and plays too fast


Kyan
 Share

Recommended Posts

I don't know why this is happening but the gif plays smoothly on chrome (link for this gif)

I'm using >GIFAnimation UDF from trancexx

#include <WindowsConstants.au3>
#include <GIFAnimation.au3>
Global $bLoading = "0x4749463839612B000B00F10000FFFFFF07A3F685D1FA07A3F621FF0B4E45545343415045322E300301000000" & _
    "21FE1A43726561746564207769746820616A61786C6F61642E696E666F0021F904090A0000002C000000002B000B00000232848E0" & _
    "8CB96D9D883F3C50A1BDE56F3CB85E036865859A166277DDE9ABEA70C672D49D787CA2EFAC4B3F93EB8A020324C15000021F90409" & _
    "0A0000002C000000002B000B0000023DC48E08CB200F6163B19A84C7AC7CF39861DEF78C6498989FCAA14A434A702CB8076BCDB1A" & _
    "DE9240EB20165141A6F58F27D8ECA4ED3E29A2C6252C7AF000021F904090A0000002C000000002B000B0000023D848E08CB300F6163A9"
    
$Form1 = GUICreate("Example", 300, 300, -1, -1, BitOR($WS_THICKFRAME,$WS_SYSMENU))
GUISetBkColor(0xFFFFFF)
$hGIF = _GUICtrlCreateGIF($bLoading, "", 125, 120,Default,Default,Default,0xFFFFFFFF)
GUIRegisterMsg(133, "_Refresh")
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            Exit

    EndSwitch
WEnd

Func _Refresh($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam
    _GIF_RefreshGIF($hGIF)
EndFunc   ;==>_Refresh

Using this udf it plays faster and blinks when is beginning the animation again.

Hope I'm doing something wrong, its hard to find cool looking loading gifs with less than 1kb :

Edited by Kyan

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Link to comment
Share on other sites

  • Moderators

I don't even see the gif, and what is the magic number 133 (without me searching for it), I noticed it fire on resize.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

No need for a GIF animation:

#include <WindowsConstants.au3>

$Form1 = GUICreate("Example", 300, 300, -1, -1, BitOR($WS_THICKFRAME,$WS_SYSMENU))
GUISetBkColor(0xFFFFFF)
Global $aAnimLabel[3] = [GUICtrlCreateLabel("", 120, 120, 11, 11), GUICtrlCreateLabel("", 136, 120, 11, 11), GUICtrlCreateLabel("", 152, 120, 11, 11)]
GUISetState(@SW_SHOW)

AdlibRegister("Anim", 150)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case -3
            AdlibUnRegister("Anim")
            GUIDelete()
            Exit
    EndSwitch
WEnd

Func Anim()
    Local $i
    Local Static $j = 0
    For $i = 0 To UBound($aAnimLabel) - 1
        GUICtrlSetBkColor($aAnimLabel[$i], 0x85D1FA)
        GUICtrlSetBkColor($aAnimLabel[$j], 0x07A3F6)
    Next
    $j = Mod($j + 1, UBound($aAnimLabel))
EndFunc
Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Looks to me like your binary data for the gif got truncated.

;~ Global $bLoading = "0x4749463839612B000B00F10000FFFFFF07A3F685D1FA07A3F621FF0B4E45545343415045322E300301000000" & _
;~     "21FE1A43726561746564207769746820616A61786C6F61642E696E666F0021F904090A0000002C000000002B000B00000232848E0" & _
;~     "8CB96D9D883F3C50A1BDE56F3CB85E036865859A166277DDE9ABEA70C672D49D787CA2EFAC4B3F93EB8A020324C15000021F90409" & _
;~     "0A0000002C000000002B000B0000023DC48E08CB200F6163B19A84C7AC7CF39861DEF78C6498989FCAA14A434A702CB8076BCDB1A" & _
;~     "DE9240EB20165141A6F58F27D8ECA4ED3E29A2C6252C7AF000021F904090A0000002C000000002B000B0000023D848E08CB300F6163A9"
Global $bLoading = "0x4749463839612B000B00F10000FFFFFF07A3F685D1FA07A3F621FF0B4E45545343415045322E300301000000" & _
   "21FE1A43726561746564207769746820616A61786C6F61642E696E666F0021F904090A0000002C000000002B000B00000232848E0" & _
   "8CB96D9D883F3C50A1BDE56F3CB85E036865859A166277DDE9ABEA70C672D49D787CA2EFAC4B3F93EB8A020324C15000021F90409" & _
   "0A0000002C000000002B000B0000023DC48E08CB200F6163B19A84C7AC7CF39861DEF78C6498989FCAA14A434A702CB8076BCDB1A" & _
   "DE9240EB20165141A6F58F27D8ECA4ED3E29A2C6252C7AF000021F904090A0000002C000000002B000B0000023D848E08CB300F61" & _
   "63A99A6A5BDC6FE20F0A13B779E1798CA4D4A0A8BA0EA60BC2EB4C633689E7C9CEE9F9529A98AC35CC308C47CAE9F2992C6252A8A" & _
   "E000021F904090A0000002C000000002B000B00000240848E08CB96D9D89894BA071B7EB1FAB9654CA8349F471E512A7427C5AEA9" & _
   "FB0EB1369BB59D8FFDB2E39164435DEDE62B4A76C8451310BC6022CE1015FA021400003B000000000000000000"
Link to comment
Share on other sites

@SmOke_N, took it from a old snippet but somehow was working

@UEZ, neat work UEZ, awesome!  :sorcerer: (You gave me a idea of doing other loading animations using autoit ^^)

@spudw2k, indeed, hex workshop doing again his bad job of putting selected data in clipboard :s, works fine if I add the last line, thank you :D

Heroes, there is no such thing

One day I'll discover what IE.au3 has of special for so many users using it.
C'mon there's InetRead and WinHTTP, way better
happy.png

Link to comment
Share on other sites

  • 1 year later...

Had fun doing some reverse-engineering and learning about the GIF file format.  Just wanted to share.

;~ $hBin = "0x4749463839612B000B00F10000FFFFFF07A3F685D1FA07A3F621FF0B4E45545343415045322E300301000000" & _
;~    "21FE1A43726561746564207769746820616A61786C6F61642E696E666F0021F904090A0000002C000000002B000B00000232848E0" & _
;~    "8CB96D9D883F3C50A1BDE56F3CB85E036865859A166277DDE9ABEA70C672D49D787CA2EFAC4B3F93EB8A020324C15000021F90409" & _
;~    "0A0000002C000000002B000B0000023DC48E08CB200F6163B19A84C7AC7CF39861DEF78C6498989FCAA14A434A702CB8076BCDB1A" & _
;~    "DE9240EB20165141A6F58F27D8ECA4ED3E29A2C6252C7AF000021F904090A0000002C000000002B000B0000023D848E08CB300F61" & _
;~    "63A99A6A5BDC6FE20F0A13B779E1798CA4D4A0A8BA0EA60BC2EB4C633689E7C9CEE9F9529A98AC35CC308C47CAE9F2992C6252A8A" & _
;~    "E000021F904090A0000002C000000002B000B00000240848E08CB96D9D89894BA071B7EB1FAB9654CA8349F471E512A7427C5AEA9" & _
;~    "FB0EB1369BB59D8FFDB2E39164435DEDE62B4A76C8451310BC6022CE1015FA021400003B"

;http://en.wikipedia.org/wiki/GIF#Example_GIF_file

$b = "0x474946383961"   ;GIF Header
$b &= "2B00"            ;Width
$b &= "0B00"            ;Height
$b &= "F1"              ;Gif Color Table
$b &= "00"                  ;Default BG Color #
$b &= "00"                  ;Default Pixel Aspect Ratio
$b &= "FFFFFF"              ;Color #0
$b &= "07A3F6"              ;Color #1
$b &= "85D1FA"              ;Color #2
$b &= "07A3F6"              ;Color #3
$b &= "21FF0B"              ;Color #4
$b &= "4E4554"              ;Color #5
$b &= "534341"              ;Color #6
$b &= "504532"              ;Color #7
$b &= "2E3003"              ;Color #8
$b &= "010000"              ;Color #9
$b &= "0021FE"              ;Color #10
$b &= "1A4372"              ;Color #11
$b &= "656174"              ;Color #12
$b &= "656420"              ;Color #13
$b &= "776974"              ;Color #14
$b &= "682061"              ;Color #15
$b &= "6A6178"              ;Color #16
$b &= "6C6F61"              ;Color #17
$b &= "642E69"              ;Color #18
$b &= "6E666F"              ;Color #19
$b &= "00"                  ;Padding?
$b &= "21F9"            ;Grahpic Control Extension
$b &= "04"                  ;GCE Data Flow
$b &= "09"                  ;Transparent BG
$b &= "0A00"                ;Animation Delay
$b &= "00"                  ;Transparent Color
$b &= "00"              ;End of GCE Block
$b &= "2C"              ;Image Descriptor
$b &= "00000000"            ;NW Corner Position (0,0)
$b &= "2B000B00"            ;Image Width & Height (2B,0B)
$b &= "00"                  ;Local Color Table
$b &= "02"                  ;Start of Image
$b &= "32"                  ;LZW Image Encoded Data Follows Byte Size
$b &= "848E08CB96D9D883F3C50A1BDE56F3CB85E036865859A166277DDE9ABEA70C672D49D787CA2EFAC4B3F93EB8A020324C1500"
      ;0                                                                                                 31
$b &= "00"                  ;End of Image Data
$b &= "21F9"            ;Grahpic Control Extension
$b &= "04"                  ;GCE Data Flow
$b &= "09"                  ;Transparent BG
$b &= "0A00"                ;Animation Delay
$b &= "00"                  ;Transparent Color
$b &= "00"              ;End of GCE Block
$b &= "2C"              ;Image Descriptor
$b &= "00000000"            ;NW Corner Position (0,0)
$b &= "2B000B00"            ;Image Width & Height (2B,0B)
$b &= "00"                  ;Local Color Table
$b &= "02"                  ;Start of Image
$b &= "3D"                  ;LZW Image Encoded Data Follows Byte Size
$b &= "C48E08CB200F6163B19A84C7AC7CF39861DEF78C6498989FCAA14A434A702CB8076BCDB1ADE9240EB20165141A6F58F27D8ECA4ED3E29A2C6252C7AF00"
      ;0                                                                                                                       3C
$b &= "00"                  ;End of Image Data
$b &= "21F9"            ;Grahpic Control Extension
$b &= "04"                  ;GCE Data Flow
$b &= "09"                  ;Transparent BG
$b &= "0A00"                ;Animation Delay
$b &= "00"                  ;Transparent Color
$b &= "00"              ;End of GCE Block
$b &= "2C"              ;Image Descriptor
$b &= "00000000"            ;NW Corner Position (0,0)
$b &= "2B000B00"            ;Image Width & Height (2B,0B)
$b &= "00"                  ;Local Color Table
$b &= "02"                  ;Start of Image
$b &= "3D"                  ;LZW Image Encoded Data Follows Byte Size
$b &= "848E08CB300F6163A99A6A5BDC6FE20F0A13B779E1798CA4D4A0A8BA0EA60BC2EB4C633689E7C9CEE9F9529A98AC35CC308C47CAE9F2992C6252A8AE00"
      ;0                                                                                                                       3C
$b &= "00"                  ;End of Image Data
$b &= "21F9"            ;Grahpic Control Extension
$b &= "04"                  ;GCE Data Flow
$b &= "09"                  ;Transparent BG
$b &= "0A00"                ;Animation Delay
$b &= "00"                  ;Transparent Color
$b &= "00"              ;End of GCE Block
$b &= "2C"              ;Image Descriptor
$b &= "00000000"            ;NW Corner Position (0,0)
$b &= "2B000B00"            ;Image Width & Height (2B,0B)
$b &= "00"                  ;Local Color Table
$b &= "02"                  ;Start of Image
$b &= "40"                  ;LZW Image Encoded Data Follows Byte Size
$b &= "848E08CB96D9D89894BA071B7EB1FAB9654CA8349F471E512A7427C5AEA9FB0EB1369BB59D8FFDB2E39164435DEDE62B4A76C8451310BC6022CE1015FA021400"
      ;0                                                                                                                             3F
$b &= "00"                  ;End of Image Data
$b &= "3B"              ;GIF File Terminator

FileWrite(FileOpen("test.gif", 18), $b)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...