Overkillz Posted September 5, 2014 Posted September 5, 2014 Hey everyone, Im here again. I hope u can help me with this little help. I will like to make a fade out the first image to the second image. Part of the code: local sWidth,sHeight = guiGetScreenSize() local Width,Height = 395,910 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) Image = guiCreateStaticImage( 0, 0, 1920, 1200, "img/login_bg.png", false ) Image2 = guiCreateStaticImage( 0, 0, 1920, 1200, "img/login_bgfinal.png", false ) guiSetEnabled (Image, false) guiSetEnabled (Image2, false) Please, I need this, Im trying to develeop a thing. Thanks for ur time, regards.
Overkillz Posted September 5, 2014 Author Posted September 5, 2014 What did you try so far, if anything? Im noob on script atm, I can make little things, that is the reason why I need ur help OT: Ur MGM is amazing
xXMADEXx Posted September 5, 2014 Posted September 5, 2014 You should use the dxDrawImage function. You can try using this code, but I didn't test it: local sWidth,sHeight = guiGetScreenSize() local Width,Height = 395,910 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) local alpha = 255 local mode = "fade" local img = "img/login_bg.png" addEventHandler ( "onClientRender", root, function ( ) if ( mode == "fade" ) then if ( alpha <= 10 ) then img = "img/login_bgfinal.png" mode = "build" else alpha = alpha - 2 end else alpha = alpha + 2 if ( alpha > 255 ) then alpha = 255 end end dxDrawImage ( 0, 0, 1920, 1200, img, tocolor ( 255, 255, 255, alpha ) ) end )
Overkillz Posted September 6, 2014 Author Posted September 6, 2014 Thanks, it is almost done, but there is a problem, that make turn the image too fast many facings and after many facings it show the bg img final It is to weird.
Overkillz Posted September 6, 2014 Author Posted September 6, 2014 I dont know how to explain me, then I make a video
Anubhav Posted September 6, 2014 Posted September 6, 2014 local sWidth,sHeight = guiGetScreenSize() local Width,Height = 395,910 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) local alpha = 255 local mode = "fade" local img = "img/login_bg.png" addEventHandler ( "onClientRender", root, function ( ) if ( mode == "fade" ) then if ( alpha <= 10 ) then img = "img/login_bgfinal.png" mode = "build" else alpha = alpha - 1 end else alpha = alpha + 1 if ( alpha > 255 ) then alpha = 255 end end dxDrawImage ( 0, 0, 1920, 1200, img, tocolor ( 255, 255, 255, alpha ) ) end )
Overkillz Posted September 6, 2014 Author Posted September 6, 2014 local sWidth,sHeight = guiGetScreenSize() local Width,Height = 395,910 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) local alpha = 255 local mode = "fade" local img = "img/login_bg.png" addEventHandler ( "onClientRender", root, function ( ) if ( mode == "fade" ) then if ( alpha <= 10 ) then img = "img/login_bgfinal.png" mode = "build" else alpha = alpha - 1 end else alpha = alpha + 1 if ( alpha > 255 ) then alpha = 255 end end dxDrawImage ( 0, 0, 1920, 1200, img, tocolor ( 255, 255, 255, alpha ) ) end ) Thanks for help me, but the problem still showing it, the difference, now its more faster
Anubhav Posted September 6, 2014 Posted September 6, 2014 local sWidth,sHeight = guiGetScreenSize() local Width,Height = 395,910 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) local alpha = 255 local mode = "fade" local img = "img/login_bg.png" addEventHandler ( "onClientRender", root, function ( ) if ( mode == "fade" ) then if ( alpha <= 10 ) then img = "img/login_bgfinal.png" mode = "build" else alpha = alpha - 5 end else alpha = alpha + 5 if ( alpha > 255 ) then alpha = 255 end end dxDrawImage ( 0, 0, 1920, 1200, img, tocolor ( 255, 255, 255, alpha ) ) end )
Overkillz Posted September 6, 2014 Author Posted September 6, 2014 local sWidth,sHeight = guiGetScreenSize() local Width,Height = 395,910 local X = (sWidth/2) - (Width/2) local Y = (sHeight/2) - (Height/2) local alpha = 255 local mode = "fade" local img = "img/login_bg.png" addEventHandler ( "onClientRender", root, function ( ) if ( mode == "fade" ) then if ( alpha <= 10 ) then img = "img/login_bgfinal.png" mode = "build" else alpha = alpha - 5 end else alpha = alpha + 5 if ( alpha > 255 ) then alpha = 255 end end dxDrawImage ( 0, 0, 1920, 1200, img, tocolor ( 255, 255, 255, alpha ) ) end ) The same thing, just more slower and less returns
Overkillz Posted September 6, 2014 Author Posted September 6, 2014 I increase it till 1000 and it doesn't make an effect of fade, just change the picture to the 2nd one.
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