Canvas.height read/write property
Get or set the height of the Canvas area. The height starts from 0 (top side of the Canvas) and increase to the bottom direction.
Example
local ui = require "ui"
require "canvas"
-- create a simple window
local win = ui.Window("Canvas.height sample", 600, 400)
local Canvas = ui.Canvas(win)
Canvas.align = "all"
function Canvas:onPaint()
self:begin()
self:clear()
self:fillellipse(300,200, 50, 50, 0xdc4f2bff)
self:flip()
end
-- Launch async Task for ui
ui.run(win)
-- Async Task to decrease Canvas height
async(function()
while win.visible do
Canvas.height = Canvas.height - 5
if Canvas.height <= 0 then
win:hide()
sys.exit()
end
sleep()
end
end)
-- wait for all tasks
waitall()