Cool fade function I dev'd
Code:
/*
* This is the fade effects lib, pretty cool.
* Copyright (C) 2009 Alexander Alvonellos
*/
/*
* Be sure to make sure that you declare the program name properly.
* It's a good lib, and I've tried not to make it too confusing for
* the beginners to use. They should just have to set something like
* ProgramTitle := A_ScriptName or whatever and that should work fine.
* Or they cand o what I did and just set the program title in a variable
* (See var.ahk)
*/
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* elektron@cox.net
*
*/
FadeIn(Delay, ProgramTitle)
{
Transparency = 0
Critical ;; Helps prevent flickering, misc errors
Winset, Transparent, %Transparency%, %ProgramTitle%
Loop, 254 { ;; Doesn't want to work on 255, don't change this
Transparency++
Sleep, %Delay%
Winset, Transparent, %Transparency%, %ProgramTitle%
}
Critical, Off
}
FadeOut(Delay, ProgramTitle)
{
Transparency = 255
Critical ;; Helps prevent flickering, misc errors
Loop, 254 { ;;Doesn't seem to work on 255...
Transparency--
Sleep, %Delay%
WinSet, Transparent, %Transparency%, %ProgramTitle%
}
Critical, Off
}