Jump to content

dxDrawRectangle - alpha 0 to 255 from side-to-side


Recommended Posts

2 hours ago, XaskeL said:

Try creating something like this in a shader (it's really easy) or make a similar background in Photoshop.

image.png

Could you explain more? I don't know how to use this.

 

I was thinking smoething like that (from user Pa3ck), above is for 2-colors dxDraw, I need for alpha 

addEventHandler ("onClientResourceStart", resourceRoot, 
    function () 
        texture = dxCreateTexture (300, 25)
        local pixels = dxGetTexturePixels (texture)
        for i=0,300 do	 
			local progress = 100 / 300 * i / 100
			local r, g, b = interpolateBetween ( 255, 0, 0, 255, 255, 0, progress, "Linear")
            for j=0,25 do
                dxSetPixelColor (pixels, i, j, r, g, b, 255)
            end
        end
        dxSetTexturePixels (texture, pixels)
		texture2 = dxCreateTexture (600, 25)
        local pixels2 = dxGetTexturePixels (texture2)
        for i=0,300 do	 
			local progress = 100 / 300 * i / 100
			local r, g, b = interpolateBetween ( 255, 255, 0, 0, 255, 0, progress, "Linear")
            for j=0,25 do
                dxSetPixelColor (pixels2, i, j, r, g, b, 255)
            end
        end
        dxSetTexturePixels (texture2, pixels2)
	end)

addEventHandler ("onClientRender", root,
    function ()
         dxDrawImage (300, 300, 300, 25, texture)
		 dxDrawImage (600, 300, 300, 25, texture2)
    end)
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...