LinearGradient.stop
Get or set the ending two-dimensional coordinates of the linear gradient
Example
--! luart-extensions
import 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
await win:showasync()