LinearGradient.stop read/write property


Get or set the ending two-dimensional coordinates of the linear gradient

To set this property, use a table as a list of two numbers, for example { 0, 0 }
When getting this property, you can access the coordinates by using the fields x and y

Example

local ui = require "ui" require "canvas" -- create a simple Window local win = ui.Window("LinearGradient.stop sample", "fixed", 500, 400) -- create a Canvas local canvas = ui.Canvas(win) canvas.align = "all" local gradient = canvas:LinearGradient { [0] = 0xE30940FF, [0.33] = 0xE7D702FF, [0.66] = 0x0FA895FF, [1] = 0x1373E8FF } gradient.start = { 0, 0 } gradient.stop = { canvas.width, 0 } function canvas:onPaint() self:fillrect(0, 0, canvas.width, canvas.height, gradient) end win:show() -- update user interface repeat ui.update() until not win.visible