Sign in to follow this  
Followers 0
pintas

right way to fade in?

7 posts in this topic

#1 ·  Posted (edited)

I'm trying to fade a window but i ran into some problems.

I tried using WinAnimate.au3 but it flickers, because i want the window to have a particular transparency value. So the fade in effect goes to transparency value 255 and then back.

I also tried this?

For $TRANSCOUNT = 0 To 220 Step - 10
    WinSetTrans($2gui, "", $TRANSCOUNT)
    Sleep(15)
Next

But nothing happens...

How can i do this right?

Edited by pintas

Share this post


Link to post
Share on other sites



I'm trying to fade a window but i ran into some problems.

I tried using WinAnimate.au3 but it flickers, because i want the window to have a particular transparency value. So the fade in effect goes to transparency value 255 and then back.

I also tried this?

For $TRANSCOUNT = 0 To 220 Step - 10
    WinSetTrans($2gui, "", $TRANSCOUNT)
    Sleep(15)
Next

But nothing happens...

How can i do this right?

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $handle, "int", 140, "long", 0x00080000)

just before GUISetState()...

$handle is the handle returned by GUICreate and in this example, 140 is the time in millisecs for the fade in to occur (smaller for faster fade ins). Use WinSetTrans to set the desired transparency after GUISetState()...

Share this post


Link to post
Share on other sites

Thanks for your reply, but the flicker occurs as well. Its not a smooth transition.

I'm trying to use a very small transparency value, something like 100, and that way the fade goes from 0 to 255 and then back to 100, it doesn't look very good.

Any other way?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks for your reply, but the flicker occurs as well. Its not a smooth transition.

I'm trying to use a very small transparency value, something like 100, and that way the fade goes from 0 to 255 and then back to 100, it doesn't look very good.

Any other way?

Back to square one then.. The for loop method is your best bet then. The reason why nothing happened is:

For $TRANSCOUNT = 0 To 220 Step - 10

WinSetTrans($2gui, "", $TRANSCOUNT)

Sleep(15)

Next

A For loop will execute zero times if:

start > stop and step > 0, or

start < stop and step is negative

So nothing in your for loop actually ever executed. Edited by Koshy John

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

:) That's because i'm too much of a n00b! I was trying this for the fade out, i thought the reversed values would do the opposite.

For $TRANSCOUNT = 254 To 0 Step - 10
        WinSetTrans($2gui, "", $TRANSCOUNT)
        Sleep(15)
    Next

So i reversed the values to see if it worked.

But how can i fix that?

Edited by pintas

Share this post


Link to post
Share on other sites

:) That's because i'm too much of a n00b! I was trying this for the fade out, i thought the reversed values would do the opposite.

For $TRANSCOUNT = 254 To 0 Step - 10
        WinSetTrans($2gui, "", $TRANSCOUNT)
        Sleep(15)
    Next

So i reversed the values to see if it worked.

But how can i fix that?

For $TRANSCOUNT = 0 To 255 Step 10
    WinSetTrans($2gui, "", $TRANSCOUNT)
    Sleep(15)
Next

I hope that answers your question...

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