Jump to content

Animation Simulation


rush4hire
 Share

Recommended Posts

Code here is taken from an old post by Larz http://www.autoitscript.com/forum/index.php?showtopic=20634

And the floating merlin example that comes with AutoIt3 ( the example for GUICtrlCreatePic )

I used IfranView to extract the frames from the gif, and then used the "Create Panorama image.." feature to make a long bmp.

Then I made another one that's smaller..

At first I loaded all the images in the same coords on the gui, and they where all hidden, and I would go through the array of control handles hiding and showing them. It worked great, but it kinda flickered, which looks cheap.

Func Swimg()
    GUICtrlSetState($pics[$ccc], 32)
    $ccc += 1
    If $ccc > 11 Then $ccc = 0
    GUICtrlSetState($pics[$ccc], 16)
EndFunc
oÝ÷ Ù*!z··öƳ"¶è­ìZ^±«miÈfz{

Here's the origional animated gif

animation_simulation.zip

Link to comment
Share on other sites

It would be nice to just use an animated gif, and if your script could extract the different images and put them together.

But I guess the bmp compress very well.

I thought bitmap was a very primitive image format because it's so big, but now I realize it compresses so well when you compile an .exe

Link to comment
Share on other sites

Hi,

you might like this

replace this

$gui=GUICreate("test transparentpic", 200, 100)
oÝ÷ Û­Øb±«­¢+Ø(ÀÌØíÕ¤õU%
ÉÑ ÅÕ½ÐíÑÍÐÑɹÍÁɹÑÁ¥ÅÕ½Ðì°ÈÀÀ°ÄÀÀ°´Ä°´Ä°´Ä°ÀÌØí]M}a}Q==1]%9=¤oÝ÷ ÚÞ½éÛzÛ^­«­¢+Ø(ÀÌØíÕ¤õU%
ÉÑ ÅÕ½ÐíÑÍÐÑɹÍÁɹÑÁ¥ÅÕ½Ðì°ÈÀÀ°ÄÀÀ°´Ä°´Ä°´Ä°ÀÌØí]M}a}Q==1]%9=¬ÀÌØí]M}a}Q=A5=MP¤(oÝ÷ Øêð«]£*.¶§¦èºÛaÊÞ¦VzØb±«­¢+Ø)¼(ÀÌØíµÍôU%Ñ5Í ¤)չѥ°ÀÌØíµÍôÀÌØíU%}Y9Q}
1=MoÝ÷ Ùú+¶¬jëh×6
do
    $msg = GUIGetMsg()
    $pos = MouseGetPos()
    WinMove($picgui,"",$pos[0]+5,$pos[1])
until $msg = $GUI_EVENT_CLOSE
oÝ÷ Ø
ãjzlü¨¹ÈZ­æ¢÷­)à²f²mëazZ(¥«­¢+Ø)¼(ÀÌØíµÍôU%Ñ5Í ¤)չѥ°ÀÌØíµÍôÀÌØíU%}Y9Q}
1=MoÝ÷ Ú+^®Ú¢+eG­+ºÚ"µÍÚ[HBTÛY
L
BÑ[ÓÜÙÛÝÙHÎÚ[HBIÌÍÜÜÈH[ÝÙQÙ]ÜÊ
BUÚ[[ÝJ   ÌÍÜXÙÝZK   ][ÝÉ][ÝË    ÌÍÜÜÖÌJÍK    ÌÍÜÜÖÌWJBÙ[
Edited by arjan staring
Link to comment
Share on other sites

  • Moderators

Could some please cut this code down some so that I can get this 7 picture gif splash screen going without the flicker?

Its currently 2 complex for me to understand and get into my code

Thanks

MajSlayer420

:whistle: That's funny!!!

I don't think I've ever seen a request to Dummy Down a piece of code so someone could use it!!! :P

A suggestion... If it's too complex for you to understand, you don't need to be using it... If you are sharing what you have with others, you may have something hurt the end-user because of your lack of understanding.

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

:whistle: That's funny!!!

I don't think I've ever seen a request to Dummy Down a piece of code so someone could use it!!! :P

You know, I had to read that post about 5 times just to understand how "lame" the thinking really was...

Then I did't even know how to respond to it!!!

Glad you did!!! ( Dummy Down )

BTW, Thanks for Sharing Rush

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

:whistle: That's funny!!!

I don't think I've ever seen a request to Dummy Down a piece of code so someone could use it!!! :P

A suggestion... If it's too complex for you to understand, you don't need to be using it... If you are sharing what you have with others, you may have something hurt the end-user because of your lack of understanding.

he's probably talkin about the example.. not the udf

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

try this..

#region -Example
#include <GUIConstants.au3>
HotKeySet("{ESC}", "_exit")

Global $grspeed = 100,  $nnn
Global $gui,$bmpctrl
Global $bmpfile = "looparrow_long.bmp"
Global $bmphight = 87
Global $bmpwidth = 120
Global $bmpwidth2 = 1440
$gui=GUICreate("test transparentpic", 200, 100,-1,-1,-1,$WS_EX_TOOLWINDOW)
$picgui=GUICreate("qqqqqq", $bmpwidth, $bmphight, 10, 10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_MDICHILD),$gui)
$bmpctrl = GUICtrlCreatePic( $bmpfile,0,0, 0,0)
GUISetState(@SW_SHOW,$picgui)
GUISetState(@SW_SHOW,$gui)
WinSetTrans ( "test transparentpic", "", 0 )
$picPos = WinGetPos($picgui)
$guiPos = WinGetPos($gui)
$graphic = _ProgressInitiateGraphic($picgui,$bmpctrl,$bmpfile)

While 1
    _ProgressSwimg($nnn,$graphic,$bmpwidth,$bmpwidth2,$bmphight)
    sleep($grspeed)
WEnd
_exit()

Func _exit()
    _ProgressDestroyGraphic($graphic)
    Exit
EndFunc
#endregion

Func _ProgressSwimg(ByRef $nnn, $dllspecs,$bmpwidth,$bmpwidth2,$bmphight, $opendll = "gdi32.dll")
    Local Const $SRCCOPY = 0xCC0020
    $nnn += $bmpwidth
    If $nnn > $bmpwidth2-1 Then $nnn = 0
    DLLCall( $opendll, "int","BitBlt","int",$dllspecs[0],"int",0,"int",0,"int",$bmpwidth,"int", $bmphight, _
            "int",$dllspecs[1],"int",$nnn,"int",0,"int",$SRCCOPY)
EndFunc
       
       
Func _ProgressInitiateGraphic(ByRef $hWin, ByRef $nID, $szFile)
    Local Const $GWL_HINSTANCE = -6
    Local Const $IMAGE_BITMAP = 0
    Local Const $LR_LOADFROMFILE = 0x0010
    Local $dllspecs[4],$dll, $hwnd, $opendll,$phWnd,$dc,$dc1,$old
    $hwnd = WinGetHandle($hWin)
    $opendll = DllOpen("gdi32.dll")
    Local $dll = DllOpen("user32.dll")
    $hInst = DllCall($dll, "int", "GetWindowLong", "hWnd", $hwnd, "int", $GWL_HINSTANCE)
    $hBmp = DllCall($dll, "hwnd", "LoadImage", "hwnd", $hInst[0], "str", $szFile, _
            "int", $IMAGE_BITMAP, "int", 0, "int", 0, "int", $LR_LOADFROMFILE)
    $phWnd = DLLCall($dll, "hwnd", "GetDlgItem", "hwnd", $hWin, "int", $nID)
    $dc = DllCall($dll,"int","GetDC","hwnd",$phWnd[0])
    $dc1 = DLLCall($opendll,"int","CreateCompatibleDC","int",$dc[0])
    $old = DLLCall($opendll,"hwnd","SelectObject","int",$dc1[0],"hwnd",$hBmp[0])
    $dllspecs[0] = $dc[0]
    $dllspecs[1] = $dc1[0]
    $dllspecs[2] = $hBmp[0]
    $dllspecs[3] = $old[0]
    DllClose ($dll)
    Return $dllspecs
EndFunc

Func _ProgressDestroyGraphic($dllspecs)
    Local $opendll = DllOpen("gdi32.dll")
    DLLCall($opendll,"hwnd","SelectObject","int",$dllspecs[1],"hwnd",$dllspecs[3])
    DLLCall("user32.dll","int","ReleaseDC","hwnd",0,"int",$dllspecs[0])
    DLLCall($opendll,"int","DeleteDC","int",$dllspecs[1])
    DLLCall($opendll,"int","DeleteObject","hwnd",$dllspecs[2])
    DllClose($opendll)
EndFunc
Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

  • 2 months later...

You know, I had to read that post about 5 times just to understand how "lame" the thinking really was...

Then I did't even know how to respond to it!!!

Glad you did!!! ( Dummy Down )

BTW, Thanks for Sharing Rush

8)

1. Unless you're the type that likes to laugh and call names at those who aren't as "advanced" as you, it's not funny at all. And I can't think of a "lamer" response than what the two of you made. Both of you have certainly lost my respect.

2. There's a lot of code on this board that forces me to squint, scratch my head, and wonder WTF is going on between #Include and Exit. A little CODE COMMENTING within these scripts would be well appreciated by ANYONE.

3. You will be well advised to remember we all have skills in different areas, and chances are, I - as well as others here - have a few that would put you in your place!

Now continue to stroke each other's egos. That seems to be another skill you've just perfected.

My AutoIT's:[topic="53958"]Personal Encyclopedia/Dictionary[/topic][topic="46311"]MS Access (Style) Database[/topic]"Some people are born on third base and go through life thinking they hit a triple."

Link to comment
Share on other sites

Well said, nerdgerl. I especially agree on number 2, sometimes it seems like I am the only person in the world who actually comments their code, not just for my own benefit but for the benefit of others if I decide to release it. I don't know if people think that it will make them look "noobish" or make their code look messy to include comments but it is a very good programming practice to get into.

I also don't like it when people blindly rubbish peoples' requests and code. I am okay with criticism but insulting people because you think that their ideas are somehow beneath you is, in my opinion, just not on.

[/rant]

Still a pretty useful script, thanks for sharing - this one will be saved to the hard drive definitely.

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...