Fill gradient box

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

_fill_gradient_box(x, y, width, height, corner, feather, color_inner, color_outer)

_fill_gradient_box is used to apply all queued drawings into a boxed gradient fill.

Info This function may only be called within a canvas draw callback

Return value

This function won't return any value.

Arguments

# Argument Type Description
1 x Number X position of the box in pixels
2 y Number Y position of the box in pixels.
3 width Number Width of the box in pixels.
4 height Number Height of the box in pixels
5 corner Number Corner radius in pixels.
6 feather Number Feather, this determines the blurring effect.
7 color_inner Color The color at point 1. Can be RGBA hex string ("#FF0000FF"), the name of the color ("red") or separate number table {1, 0, 0, 1 }.
8 color_outer Color The color at point 2. Can be RGBA hex string ("#FF0000FF"), the name of the color ("red") or separate number table {1, 0, 0, 1 }.

Example

canvas_id = canvas_add(0, 0, 200, 200, function()
  -- Create a shape
  _rect(0, 0, 200, 200)

  -- Fill gradient
  _fill_gradient_box(75, 75, 50, 50, 10, 10, "red", "yellow")
end)
Output of code above