Parent Paint Library display.* Revision Release 2024.3703 Keywords gradient paint See also object.fill object.stroke
A gradient paint creates a linear progression from one color to another.
local paint = { type = "gradient", color1 = { r,g,b,a }, color2 = { r,g,b,a }, direction = }
String. String value of "gradient"
.
Array. An RGB+A array of color channels for the start color. Each number should range between 0
and 1
and represent the corresponding value for that channel.
Array. An RGB+A array of color channels for the end color. Each number should range between 0
and 1
and represent the corresponding value for that channel.
String. The direction of the gradient from color1
to color2
. This can be "down"
, "up"
, "left"
, or "right"
. Default is "down"
.
If number. is passed as direction
parameter, "down"
would be used and fill.rotation would be applied its value.
(Inherits properties from Paint)
local paint = { type = "gradient", color1 = { 1, 0, 0.4 }, color2 = { 1, 0, 0, 0.2 }, direction = "down" } local rect = display.newRect( 200, 200, 300, 300 ) rect.fill = paint