DakiLLa Posted January 19, 2009 Share Posted January 19, 2009 Hi. I want to make a smooth opening and closing gui menus. I know that i need to use guiGetAlpha and guiSetAlpha but i dont know how to use it correctly. Can you help me with small example or just tell what i need to do. thx Link to comment
Gamesnert Posted January 19, 2009 Share Posted January 19, 2009 setTimer(guiSetAlpha,100,10,theGUI,guiGetAlpha(theGUI)/255+0.1) (although it seems weird with guiGetAlpha returning between 0 and 255, while guiSetAlpha only seem to work between 0 and 1... ) Or use the example HERE. Link to comment
DakiLLa Posted January 19, 2009 Author Share Posted January 19, 2009 ehm, i have made something, but no result..where i have mistakes ? g_res_root = getResourceRootElement ( getThisResource () ) addEventHandler ( "onClientResourceStart", g_res_root, function () x, y = guiGetScreenSize () p_wnd = guiCreateWindow ( x-280, y-600, 243, 164, "test", false ) close () end ) function close ( ) local currentAlpha = guiGetAlpha ( p_wnd ) local newAlpha = currentAlpha - 4 if newAlpha < 0 then newAlpha = 0 end guiSetAlpha ( p_wnd, newAlpha ) if newAlpha ~= 0 then setTimer ( open, 50, 1, p_wnd ) end end Link to comment
Gamesnert Posted January 19, 2009 Share Posted January 19, 2009 g_res_root = getResourceRootElement ( getThisResource () ) addEventHandler ( "onClientResourceStart", g_res_root, function () x, y = guiGetScreenSize () p_wnd = guiCreateWindow ( x-280, y-600, 243, 164, "test", false ) close () end ) function close ( ) local currentAlpha = guiGetAlpha ( p_wnd ) local newAlpha = currentAlpha - 4 if newAlpha < 0 then newAlpha = 0 end guiSetAlpha ( p_wnd, newAlpha ) if newAlpha ~= 0 then setTimer ( close, 50, 1, p_wnd ) end end Try this? You put open in the timer while there's no open. Link to comment
DakiLLa Posted January 19, 2009 Author Share Posted January 19, 2009 oh..i just forgot edit word "open" of word "close" in editinig my post.. doesnt help all the same.. Link to comment
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