Image.width readonly property


Get the Image width. The width starts from 0 (left side of the Image) and increases to the right direction.

Example

local ui = require "ui" require "canvas" -- create a simple Window local win = ui.Window("Canvas.Image() sample", "fixed", 320, 200) -- create a Canvas local canvas = ui.Canvas(win) canvas.align = "all" local img = canvas:Image("LuaRT.png") local xpos = -img.width function canvas:onPaint() self:clear() img:draw(xpos, 30) xpos = xpos > canvas.width and -img.width or xpos+6 end win:show() -- update user interface repeat ui.update() until not win.visible