[Function] Smart WinFade[In|Out]

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
joedf
Posts: 8951
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

[Function] Smart WinFade[In|Out]

03 Nov 2013, 15:45

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%
    	}
    }
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
huyaowen
Posts: 109
Joined: 28 Jul 2014, 01:15

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

23 Sep 2014, 02:32

nice,thanks.
User avatar
joedf
Posts: 8951
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

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

23 Sep 2014, 08:52

You're welcome. :)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
Skrell
Posts: 302
Joined: 23 Jan 2014, 12:05

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

24 Sep 2014, 08:30

What are you currently using this function for Joedf? Are you just using hotkeys to fade the active window at will?
User avatar
joedf
Posts: 8951
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

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

25 Sep 2014, 11:36

Well, it was originally created for Qonsole ;)
http://qonsole-ahk.sourceforge.net/
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
h0ll0w
Posts: 4
Joined: 29 Jan 2014, 11:55
Location: Colorado
Contact:

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

30 Sep 2014, 08:48

thanks joedf this will help me out a lot!
AHK 1.1.26.01 OS Win 7 and 10
User avatar
joedf
Posts: 8951
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

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

30 Sep 2014, 15:47

no problemo ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: jchestnut and 64 guests