Skip to content

raylib.GenImageGradientLinear

JoeStrout edited this page Apr 29, 2026 · 2 revisions

Generate image: linear gradient The direction value specifies the direction of the gradient (in degrees) with 0 being vertical (from top to bottom), 90 being horizontal (from left to right) The gradient effectively rotates counter-clockwise by the specified amount

Parameters

Parameter Default Value Note
width 256
height 256
direction 0
start BLACK
end WHITE

Return value

Condition Return Value
(always) map

Notes

Example

// Vertical gradient from black (top) to white (bottom)
img = raylib.GenImageGradientLinear(128, 128, 0, raylib.BLACK, raylib.WHITE)
tex = raylib.LoadTextureFromImage(img)
raylib.UnloadImage img
raylib.BeginDrawing
  raylib.ClearBackground raylib.BLACK
  raylib.DrawTexture tex, 0, 0, raylib.WHITE
raylib.EndDrawing
raylib.UnloadTexture tex

Clone this wiki locally