DrawRectGradient

Enqueue a filled rectangle with gradient in the current build buffer.

Syntax

Susano.DrawRectGradient(x, y, w, h, 
    r1, g1, b1[, a1], 
    r2, g2, b2[, a2],
    r3, g3, b3[, a3],
    r4, g4, b4[, a4],
    rounding
) -> void

Parameters

x, y (number): Top-left corner in pixels.

w, h (number): Width and height in pixels.

r1, g1, b1 (number): Color in [0..1].

r2, g2, b2 (number): Color in [0..1].

r3, g3, b3 (number): Color in [0..1].

r4, g4, b4 (number): Color in [0..1].

a1, a2, a3, a4 (number, optional): Alpha in [0..1]. Default: 1.0

rounding (number): Rounding, 0 for no rounding

Return(s)

None

Behavior

Appends a filled rectangle outline with gradient to the build buffer.

Visible after Susano.SubmitFrame(). Persists until next submit.

Example(s)

Citizen.CreateThread(function()
    while true do
        Wait(0)

        local t = GetGameTimer() / 2800.0  

        local tl_r = math.abs(math.sin(t * 1.0))
        local tl_g = math.abs(math.sin(t * 0.7))
        local tl_b = math.abs(math.sin(t * 1.3))

        local tr_r = math.abs(math.sin(t * 1.6))
        local tr_g = math.abs(math.sin(t * 0.9))
        local tr_b = math.abs(math.sin(t * 1.1))

        local br_r = math.abs(math.sin(t * 2.0))
        local br_g = math.abs(math.sin(t * 1.4))
        local br_b = math.abs(math.sin(t * 0.8))

        local bl_r = math.abs(math.sin(t * 0.5))
        local bl_g = math.abs(math.sin(t * 1.8))
        local bl_b = math.abs(math.sin(t * 1.2))

        Susano.BeginFrame()
        Susano.DrawRectGradient(300.0, 300.0, 240.0, 240.0, tl_r, tl_g, tl_b, 1.0, tr_r, tr_g, tr_b, 1.0, br_r, br_g, br_b, 1.0, bl_r, bl_g, bl_b, 1.0, 18.0)           
        Susano.SubmitFrame()
    end
end)