Sign in to follow this  
Followers 0
JonusC

Animated Splash Screen?

7 posts in this topic

...basically I want to have a splash screen that draws similar to a PNG splash [with transparency and such] but I want to make it animated! I thought the simplest way would be to just use the normal PNG splash method, but loop it [draw image; kill image; draw next image; etc] but this is highly CPU-eating and SLEEP doesnt exactly give a nice framerate.... an example is, if anyone has seen it, like what the Nero 8 loading doo-dad does - the little red-wheel spinning-thing. Posted Image

Basically, a loading animation with transparency on every frame.

...I am a n00b of sorts at AuoIt3 but i'm learning as I go, converting my millions of BATCH programs and scripts and whatnot to a unified GUI frontend - and I am a graphic designer, and really want to make my software visually AWESOME and professional :P

For those interested, a trauncated au3 script of just my splash screen is attatched :( with some SLEEP's chucked in there where the normal "loading" code goes just to give an example of my current loading animation [simple progress bar].

THANKS in ADVANCE guys for any help, im sorry if this has been done before I really have searched the forums for nearly an hour but couldnt find anything sorry if its been answered and thanks again :idea:

gxe_splash_demo.zip

Share this post


Link to post
Share on other sites



...basically I want to have a splash screen that draws similar to a PNG splash [with transparency and such] but I want to make it animated! I thought the simplest way would be to just use the normal PNG splash method, but loop it [draw image; kill image; draw next image; etc] but this is highly CPU-eating and SLEEP doesnt exactly give a nice framerate.... an example is, if anyone has seen it, like what the Nero 8 loading doo-dad does - the little red-wheel spinning-thing. Posted Image

Basically, a loading animation with transparency on every frame.

...I am a n00b of sorts at AuoIt3 but i'm learning as I go, converting my millions of BATCH programs and scripts and whatnot to a unified GUI frontend - and I am a graphic designer, and really want to make my software visually AWESOME and professional :P

For those interested, a trauncated au3 script of just my splash screen is attatched :( with some SLEEP's chucked in there where the normal "loading" code goes just to give an example of my current loading animation [simple progress bar].

THANKS in ADVANCE guys for any help, im sorry if this has been done before I really have searched the forums for nearly an hour but couldnt find anything sorry if its been answered and thanks again :idea:

Graphics is something I'm not at all good at all. But in case it helps, here is a simple animation I use for an alarm clock. You need to have the 4 bitmaps (in the alarm1.zip file) in the same folder as the script when you run it.

The rotating ring would be quite easy I think.

#include <WindowsConstants.au3>

Global Const $WS_EX_COMPOSITED = 0x2000000
Global Const $ALINCRX = 6;step sizefor animated alark clock travel left to right
Global $alarmTriggered = False, $picNo = 0, $alarm = 0xffff, $steps = 0, $stp = 0,$incr = 1
Global $timetip = "Some message"
Global $guiAlOn = showalarm()
while 1
    sleep(30)
WEnd



Func ShowAlarm()
    
    Local $GuiRing = GUICreate("test", 67, 80, 200, 200, $WS_POPUP, BitOR($WS_EX_COMPOSITED, $WS_EX_LAYERED, $WS_EX_TOPMOST))
    $alarm = GUICtrlCreatePic("alarm02.bmp", 0, 0, 67, 80)
    GUISetState()
    $picNo = 0

    AdlibEnable("ring", 30)
    Return $GuiRing
EndFunc  ;==>ShowAlarm


Func Ring()
    $stp += 1 * $incr
    $wp = WinGetPos($guiAlOn)
    If Abs($stp) = $ALINCRX Then
        WinSetOnTop($guiAlOn, "", 1)
        
        $picNo = Mod($picNo + 1, 3)
        GUICtrlSetImage($alarm, "alarm0" & 3 - $picNo & ".bmp")
        $wp = WinGetPos($guiAlOn)
        If $wp[0] > @DesktopWidth - 75 Then $incr = -1
        If $wp[0] < 4 Then $incr = 1
        WinMove($guiAlOn, "", $wp[0] + $incr * $ALINCRX, $wp[1])
        $wp = WinGetPos($guiAlOn)
        $stp = 0
    EndIf
    ToolTip($timetip, $wp[0] + $stp, $wp[1] + $wp[3])
EndFunc

alarm01.zip


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Haha thats very funky! And funny! Thanks for your help! With that knowledge perhaps I will try a few more things :P Thanks again :idea:

EDIT: Changing the AdlibEnable("ring", 30) to AdlibEnable("ring", 3) and the SLEEP(30) to SLEEP(3) just as a test to see how 'fast' I can go without saturating the CPU turned out fairly well, 30-35% CPU usage is still pretty heavy but im on an old Pentium4 3GHz hehe. But the truth behind why I want this is not so much as a "loading screen", moreso a fancy splash screen - so CPU usage is not a concern! However, the splash will also have sound that will trigger at certain 'events', think a sword crashing in from the top of the screen into the start-bar and 'smashing' it in this example.

Obviously I can make the sound trigger at a specific point or 'frame' of the animation, so the audio/video sync (or whatever you want to call it) is not a concern, I don't think i'll have a problem with that. But if anybody knows of a more efficient way of delay without using SLEEP I would love to hear it.

What i mean is - rather than slow the animation down, like what sleep would do, I would highly prefer it to DROP FRAMES instead. But yeah, I'll have a play around and all that still and if i get something good I will post some example code incase someone else will find use of it :( Cheers!

Edited by DanielC

Share this post


Link to post
Share on other sites

You should know that if you use anything between 1-10 in Sleep() it will still be used as a 10. If you need it to "sleep" for a smaller time take a look at _HighPrecisionSleep()

Share this post


Link to post
Share on other sites

You should know that if you use anything between 1-10 in Sleep() it will still be used as a 10. If you need it to "sleep" for a smaller time take a look at _HighPrecisionSleep()

True, but in this example the sleep time doesn't even need to be reduced. It can be set at 3000 and it won't affect the animation.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

True, but in this example the sleep time doesn't even need to be reduced. It can be set at 3000 and it won't affect the animation.

Why are you quoting me? It's DanielC that doesn't know that.

Share this post


Link to post
Share on other sites

LOL yeah never knew that thanks! I really should read the entire help file :|

Yes I see that it is the ADLIB delay parameter that determines the 'delay' here. High Precision Sleep ey.... hmmm I will definately check that out too :P

Very exciting, I will start doing something within the next few days and post here another script incase a kind person has any recommendations for optimisations :( Cheers guys!

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
Sign in to follow this  
Followers 0