I added a few things that I wanted to contribute.
1. Added fade-in to make it look like a TV tube is warming up.
2. Added a black dummy background for closing to mimic the TV tube going black.
I changed the function around for my own purposes which means what I have done will not just plug into what others have done. I have the function instantiate with the "GUI, Show", I allow a re-open with Gui ID only, and the function can be passed a gui number/name OR the HWND and work. Having said that, I wanted to let you see what else could be done to add to the effect. So, before studying the script run it to see the new effects.
Code: Select all
#SingleInstance Force
#NoEnv
SetTitleMatchMode, 2 ;contains
CoordMode, Mouse, Relative
SetBatchLines, -1
Gui, 1:+HWNDGui1ID
;Gui, 1:Show, x100 h-25 w-3 ;w500 h500 x100
TVCloseOpen(Gui1ID, 100, 100, 500, 500)
;Gui,2:Show, x612 h-25 w-3 ;w500 h500 x612
Gui, 2:+HWNDGui2ID
TVCloseOpen(2, 612, 100, 300, 500, "hide")
Return
GuiEscape:
GuiClose:
TVCloseOpen(Gui1ID, "close")
TVCloseOpen(2)
return
2GuiEscape:
2GuiClose:
TVCloseOpen(2, "close")
TVCloseOpen(Gui1ID)
return
TVCloseOpen(GuiID, x = 0, y = 0, w = 0, h = 0, WidthStep = 75, HeightStep = 75)
{
static p:=[]
WinDelay:=A_WinDelay
SetWinDelay,-1
Gui,%GuiID%:+LastFound
WinGet,S,Style
if (SubStr(x, 1, 1) = "c") and (p.HasKey(GuiID))
{
;close
WinGetPos,x,y,w,h
p[GuiID] := [x,y,w,h]
Gui, %GuiID%:+AlwaysOnTop
Gui, dummy:-Caption
Gui, dummy:Color, Black
Gui, dummy:Show, % "x" x " y" y " w" w " h" h
Step:=(h-3)/HeightStep, Step2:=(w-3)/WidthStep
Loop,% HeightStep
{
WinMove,,,,% y:=y+(Step/2),,% h:=h-Step
}
Loop,% WidthStep
{
WinMove,,,% x:=x+(Step2/2),,% w:=w-Step2
}
Sleep, 500
Gui, dummy:Destroy
Gui,%GuiID%:Hide
WinMove,,,% p[GuiID].1,% p[GuiID].2,% p[GuiID].3,% p[GuiID].4
Gui, %GuiID%:+AlwaysOnTop
}
else if (SubStr(x, 1, 1) = "c") and !(p.HasKey(GuiID))
Return False
else
{
if !(p.HasKey(GuiID))
{
p.Insert(GuiID)
p[GuiID] := [x, y, w, h]
}
if !(SubStr(WidthStep, 1, 1) = "h")
{
;open
Gui, %GuiID%:+AlwaysOnTop
Gui, dummy:-Caption
Gui, dummy:Color, Black
Gui, dummy:Show, % "x" p[GuiID].1 " y" p[GuiID].2 " w" p[GuiID].3 " h" p[GuiID].4
Sleep, 250
x:=p[GuiID].1+(p[GuiID].3/2),y:=p[GuiID].2+(p[GuiID].4/2),Step:=p[GuiID].4/HeightStep,Step2:=p[GuiID].3/WidthStep
Gui,%GuiID%:Show,% "x" x " y" y " w" (S&0xC0000?-3:3) " h" (S&0xC0000?-22:3)
trans := 125
tStep := Floor((255 - trans) / HeightStep)
Loop,% WidthStep
{
WinMove,,,% x-((Step2*A_Index)/2),,% p[GuiID].3-(Step2*(WidthStep-A_Index))
}
Loop,% HeightStep
{
WinMove,,,,% yn:=y-((Step*A_Index)/2),,% hn:=p[GuiID].4-(Step*(HeightStep-A_Index))
WinSet, Transparent, % (A_Index * tStep), A
}
c := (HeightStep * tStep)
Loop, % (255 - c)
WinSet, Transparent, % c + A_Index, A
Gui, dummy:Destroy
}
}
SetWinDelay,%WinDelay%
}