sasuke78200 Posted April 27, 2011 Posted April 27, 2011 Hi guys, I want to make a transparency with an image. I've tested to change the color parameter but it doesn't work, if anyone can help me look my code: local transp = math.floor( ( ( (getTickCount()-founduTick)/ 1000 ) * 100 ) * ( 255 / 100 ) ) *256^3 + 0xffffff --outputChatBox ( "Image transp "..tostring( transp ) ) dxDrawImage( 0, 0, 960, 540, "./ressources/gfx/hud.bmp", 0, 0, 0, transp )
proracer Posted April 27, 2011 Posted April 27, 2011 Can you try this: dxDrawImage( 0, 0, 960, 540, "./ressources/gfx/hud.bmp", 0, 0, 0, tocolor ( 0, 0, 0, 0 ) )
Wojak Posted April 27, 2011 Posted April 27, 2011 if alpha = 0 than image is invisible, try tocolor ( 0, 0, 0, 100 )
sasuke78200 Posted April 27, 2011 Author Posted April 27, 2011 Yes I know but I don't to make the image totally transpent, but I want to do a progressive transparancy. But When I do function HUD_onClientRender( ) if( showHealthArmour ) then if( getTickCount()-TickCount <= 3000 ) then -- la on affiche ces putains d'images dxDrawImage ( 0, 0, 960, 540, "./ressources/gfx/hud.bmp" ) elseif( getTickCount()-TickCount >= 4000 ) then showHealthArmour = false founduTick = nil else if( founduTick == nil ) then founduTick = getTickCount( ) end -- Ici on fais notre fondu local transp = math.floor( ( 255 - ( ( (getTickCount()-founduTick)/ 1000 ) * 100 ) * ( 255 / 100 ) ) ) *256^3 + 0xffffff dxDrawImage( 0, 0, 960, 540, "./ressources/gfx/hud.bmp", 0, 0, 0, transp )--transp ) end end end addEventHandler ( "onClientRender", getRootElement( ), HUD_onClientRender ) the transparency work, but the color of the image change
Moderators Citizen Posted April 27, 2011 Moderators Posted April 27, 2011 dxDrawImage( 0, 0, 960, 540, "./ressources/gfx/hud.bmp", 0, 0, 0, tocolor ( 255, 255, 255, 125 ) ) -- 127 is the alpha ( 50% )
Moderators Citizen Posted April 27, 2011 Moderators Posted April 27, 2011 No problem ( the default color is white so 255, 255, 255 instead of 0, 0, 0 )
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