stamandster Posted January 21, 2008 Posted January 21, 2008 I thought I'd share this little script I made. I don't know if something like this has already been made but I found it useful. Mods, please feel free to move/delete. This UDF will fade transparency for a specified window. $FromNumer -> A number that it should fade from; needs to be numerical $ToNumber -> A numer that it should fade to; needs to be numerical $StepNumber -> Works in conjunction with $CountSpeed to set how fast the window will fade and how smooth it fades; needs to be numerical (generally 1-10) $CountSpeed -> Works in conjunction with $StepNumber to set how fast the window will fade and how smooth it fades; needs to be numerical (generally small and easily dividable by the $ToNumber; like 2, 10, 5) $CountWindowTitle -> Title of the window to fade The $ToNumber and $FromNumber can be swapped to fade in and out if that's your inclination. ;EXAMPLES - ; _WinSetTrans_Fade(100, 255, 5, 1, "MyWindow") ; _WinSetTrans_Fade(255, 50, 2, 10, "MyWindow") FUNC _WinSetTrans_Fade($FromNumber, $ToNumber, $StepNumber, $CountSpeed, $CountWindowTitle) Local $V For $V = $FromNumber to $ToNumber Step $StepNumber Sleep($CountSpeed) Select Case $FromNumber < $ToNumber $V += 1 Case $FromNumber > $ToNumber $V -= 1 EndSelect WinSetTrans($CountWindowTitle, "", $v) Next WinSetTrans($CountWindowTitle, "", $ToNumber) EndFunc
erezlevi Posted January 21, 2008 Posted January 21, 2008 I thought I'd share this little script I made. I don't know if something like this has already been made but I found it useful. Mods, please feel free to move/delete. This UDF will fade transparency for a specified window. $FromNumer -> A number that it should fade from; needs to be numerical $ToNumber -> A numer that it should fade to; needs to be numerical $StepNumber -> Works in conjunction with $CountSpeed to set how fast the window will fade and how smooth it fades; needs to be numerical (generally 1-10) $CountSpeed -> Works in conjunction with $StepNumber to set how fast the window will fade and how smooth it fades; needs to be numerical (generally small and easily dividable by the $ToNumber; like 2, 10, 5) $CountWindowTitle -> Title of the window to fade The $ToNumber and $FromNumber can be swapped to fade in and out if that's your inclination. ;EXAMPLES - ; _WinSetTrans_Fade(100, 255, 5, 1, "MyWindow") ; _WinSetTrans_Fade(255, 50, 2, 10, "MyWindow") FUNC _WinSetTrans_Fade($FromNumber, $ToNumber, $StepNumber, $CountSpeed, $CountWindowTitle) Local $V For $V = $FromNumber to $ToNumber Step $StepNumber Sleep($CountSpeed) Select Case $FromNumber < $ToNumber $V += 1 Case $FromNumber > $ToNumber $V -= 1 EndSelect WinSetTrans($CountWindowTitle, "", $v) Next WinSetTrans($CountWindowTitle, "", $ToNumber) EndFunc how do I start it?
stamandster Posted January 21, 2008 Author Posted January 21, 2008 (edited) Something like... expandcollapse popup#include <GUIConstants.au3> GUICreate("MyProgram", 200, 200) GUICtrlCreateLabel("Fading window test", 10,10,200,35, $SS_LEFT) GUICtrlSetFont(-1, 8, 400, 2) $Button_2 = GUICtrlCreateButton("Fade In", 10, 60, 70, 20);Fade In $Button_3 = GUICtrlCreateButton("Fade Out", 10,80, 70, 20);Fade Out GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE; -----> Close program via the X Exit Case $msg = $Button_2; -----> Fade In _WinSetTrans_Fade(100, 255, 5, 1, "MyProgram") Case $msg = $Button_3; -----> Fade Out _WinSetTrans_Fade(255, 100, 5, 1, "MyProgram") EndSelect WEnd ;EXAMPLES - ; _WinSetTrans_Fade(100, 255, 5, 1, "MyWindow") ; _WinSetTrans_Fade(255, 50, 2, 10, "MyWindow") FUNC _WinSetTrans_Fade($FromNumber, $ToNumber, $StepNumber, $CountSpeed, $CountWindowTitle) Local $V For $V = $FromNumber to $ToNumber Step $StepNumber Sleep($CountSpeed) Select Case $FromNumber < $ToNumber $V += 1 Case $FromNumber > $ToNumber $V -= 1 EndSelect WinSetTrans($CountWindowTitle, "", $v) Next WinSetTrans($CountWindowTitle, "", $ToNumber) EndFunc Edited January 21, 2008 by kickarse
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now