Skip to content

raylib.GenImageGradientLinear

JoeStrout edited this page Nov 16, 2026 · 3 revisions

Generate image: linear gradient. direction is in degrees: 0 is vertical (from top to bottom), 90 is horizontal (from left to right); the gradient 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