Jump to content
Kyan

[Solved] GIF blinks and plays too fast

Recommended Posts

Kyan

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
SmOke_N

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.

Share this post


Link to post
Share on other sites
UEZ

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
  • Like 1

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
spudw2k

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"
  • Like 1

Share this post


Link to post
Share on other sites
Kyan

@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
spudw2k

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

    • odaylton
      By odaylton
      Hello everyone ,
      Text translated from Portuguese by google - please apologize for any errors

      Once again I need a light from the gurus of this wonderful website
      I am fanatic by combobox for its usability but I am not able to uncertain images within lists ...
      I know uncertain icons, and cursors but I am not able to insert gif or jpg images.
      1) How to solve this ...
      2) will the path is to convert gif into bmp and then uncertain ... how to do that?
      #include <GUIConstantsEx.au3> #include <GuiImageList.au3> #include <GuiListView.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> ;dados de mouse #include <WinAPIRes.au3> ;COMBO #include <GuiComboBoxEx.au3> ;Fonts #include <FontConstants.au3> ;obter imagem de arquivo #include <GDIPlus.au3> #include <WinAPIGdi.au3> Example() Func Example() Local $hGUI, $hImage, $hCombo, $hFont Local $idListview, $hImage Local $sWow64 = "" Local $Pasta = "C:\WINDOWS\Cursors\3dgarro.cur" Local $PastaROMs = @MyDocumentsDir & "\Stella\ROMs\" ;com barra no final $hGUI = GUICreate("ImageList", 500, 310) GUISetFont(14, 400, 0, "Arial") ;<<<<<<<<<<this does not work for _GUICtrlComboBoxEx_Create $hCombo = _GUICtrlComboBoxEx_Create($hGUI, "", 2, 2, 494, 200) ;GUICtrlSetFont($hCombo, 14, 400, 0, "Arial");<<<<<<<<<<It does not work ; ;Create a handle to a font object $hFont = _WinAPI_CreateFont(30, 0, 0, 0, 400, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial') ;Pass the handle to _WinAPI_SetFont _WinAPI_SetFont($hCombo, $hFont) $idListview = GUICtrlCreateListView("", 2, 50, 494, 250, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT)) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_GRIDLINES, $LVS_EX_DOUBLEBUFFER)) GUISetState(@SW_SHOW) ; Initialize GDI+ library _GDIPlus_Startup() ; Load images $hImage = _GUIImageList_Create(120, 70, 6, 2) ;32,32,5,5) ; $DadosCombo = "Escolha|" & _GUIImageList_Add($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap($hCombo, 0x0000FF, 120, 70)) ;Local $aCursors[] = [32650, 32512, 32515, 32649, 32651, 32513, 32648, 32646, 32643, 32645, 32642, 32644, 32516, 32514] For $i = 1 To 10 $sFile = FileOpenDialog("Please select an image", $PastaROMs, "Image (*.jpg;*.png;*.bmp;*.gif;*.tif)", BitOR($FD_PATHMUSTEXIST, $FD_FILEMUSTEXIST)) If @error Then Exit MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "Error", "No image file has been selected", 30) $a = _GDIPlus_BitmapCreateFromFile ($sFile);<<<<< ok If @error Or Not $hImage Then MsgBox(BitOR($MB_TOPMOST, $MB_ICONERROR), "Error", "This file isn't supported by GDIPlus!") Else $b=_GUIImageList_Add($hImage, $a);<<<<<< Return -1 $DadosCombo &= "|" & $i & "_img_princ.gif""|" & $b EndIf Next _GUICtrlListView_SetImageList($idListview, $hImage, 1) _GUICtrlComboBoxEx_SetImageList($hCombo, $hImage) ; Add columns _GUICtrlListView_AddColumn($idListview, "Icons - Mouses", 350) ; Add items $a = StringSplit($DadosCombo, "|") For $i = 1 To $a[0] Step 2 _GUICtrlListView_AddItem($idListview, $a[$i], $a[$i + 1]) _GUICtrlComboBoxEx_AddString($hCombo, $a[$i], $a[$i + 1], $a[$i + 1]) Next ;AutoIt_Debugger_Command:Disable_Debug ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() ;AutoIt_Debugger_Command:Enable_Debug EndFunc ;==>Example tks
    • 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
       
×