Kyan

[Solved] GIF blinks and plays too fast

6 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



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.


[center]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.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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
1 person likes this

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
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"
1 person likes this

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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)

 

Share this post


Link to post
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

  • Similar Content

    • wakillon
      By wakillon
      Animated Gif Analyzer
      Display internal infos from animated gifs
      Global and Local Palettes supported
      A value in red indicate that value is false or useless
      Flashing green text ( BK or TR)  indicate background color and transparent color
      Download available in download section

      I created this script because I needed, for an other project, to know in detail the internal characteristics of animated gif
      I had searched a similar soft on internet but I didnt found anything ...
       
    • wakillon
      By wakillon
      Display internal infos from animated gifs
      Global and Local Palettes supported
      A value in red indicate that value is false or useless
    • wakillon
      By wakillon
      Convert an animated Gif to an Avi file for use with GUICtrlCreateAvi function.
       
    • wakillon
      By wakillon
      An other tool for AutoIt Coders :
      Gif2Avi permit to convert an animated Gif to an Avi file for use with the (rarely used) GUICtrlCreateAvi function.
      Use an Avi file as loader or animation in a script (see StringFinder for example) is easier than use an animated gif.
      With this little tool you can also :
      _ Set the AVI file dimensions ( height will follow width changes for preserve ratio W/H )
      _ Change FPS (frames per second) 
      _ Try an other background color ( used in _GDIPlus_BitmapCreateHBITMAPFromBitmap function)
      _ Crop width and height (From the original dimension)

      Thanks to monoceres, Prog@ndy and UEZ for AVI functions.
      Source and compiled Version are available in the Download Section.
      May be the "GUICtrlCreateAvi" function will be a bit more used ! 
       
      Some Links for find or create loaders/spinners
      preloaders.net        loading.io      dribbble.com       chimply.com      tools.bit-hive.com
       
    • wakillon
      By wakillon
      Create animated gif from capture.