Page 1 of 1

[Function] Smart WinFade[In|Out]

Posted: 03 Nov 2013, 15:45
by joedf
Arguments
  • w : wintitle
    t : final transparency
    i : increment
    d : delay (between each increment)
Behaviour
  • if : t > current, increases current transparency [i+]
    if : t < current, decreases current transparency [i-]
Usage
  • Code: Select all

    Gui Color, 0x1A1A1A
    Gui +E0x20 -Caption +LastFound +ToolWindow +AlwaysOnTop +hwndHgui
    WinSet, Transparent, 0
    Gui Show, x0 y0 w%A_screenwidth% h%A_screenHeight%
    winfade("ahk_id " Hgui,100,5) ;fade in
    sleep 1000
    winfade("ahk_id " Hgui,10,5) ;fade out
    exitapp
Function
  • Code: Select all

    winfade(w:="",t:=128,i:=1,d:=10) { ; by joedf  -  http://ahkscript.org/boards/viewtopic.php?f=6&t=512
    	w:=(w="")?("ahk_id " WinActive("A")):w
    	t:=(t>255)?255:(t<0)?0:t
    	WinGet,s,Transparent,%w%
    	s:=(s="")?255:s ;prevent trans unset bug
    	WinSet,Transparent,%s%,%w% 
    	i:=(s<t)?abs(i):-1*abs(i)
    	while(k:=(i<0)?(s>t):(s<t)&&WinExist(w)) {
    		WinGet,s,Transparent,%w%
    		s+=i
    		WinSet,Transparent,%s%,%w%
    		sleep %d%
    	}
    }

Re: [Function] Smart WinFade[In|Out]

Posted: 23 Sep 2014, 02:32
by huyaowen
nice,thanks.

Re: [Function] Smart WinFade[In|Out]

Posted: 23 Sep 2014, 08:52
by joedf
You're welcome. :)

Re: [Function] Smart WinFade[In|Out]

Posted: 24 Sep 2014, 08:30
by Skrell
What are you currently using this function for Joedf? Are you just using hotkeys to fade the active window at will?

Re: [Function] Smart WinFade[In|Out]

Posted: 25 Sep 2014, 11:36
by joedf
Well, it was originally created for Qonsole ;)
http://qonsole-ahk.sourceforge.net/

Re: [Function] Smart WinFade[In|Out]

Posted: 30 Sep 2014, 08:48
by h0ll0w
thanks joedf this will help me out a lot!

Re: [Function] Smart WinFade[In|Out]

Posted: 30 Sep 2014, 15:47
by joedf
no problemo ;)