Canvas.width read/write property


Get or set the Canvas area width. The width starts from 0 (left side of the Canvas) and increases to the right direction.

Example

local ui = require "ui" require "canvas" -- create a simple window local win = ui.Window("Canvas.x sample", 600, 400) local Canvas = ui.Canvas(win) Canvas.align = "all" function Canvas:onPaint() self:clear() self:fillellipse(300,200, 50, 50, 0xdc4f2bff) end -- shows the window win:show() -- update user interface and increase Canvas horizontal position repeat ui.update() Canvas.width = Canvas.width - 5 until not win.visible or (Canvas.width == 0)