Canvas.sync read/write property


Get or set the Canvas synchronisation mode. When set to true (the default), the Canvas is redrawn 30 times per second by calling its Canvas.onPaint() event.

Example

local ui = require "ui" require "canvas" local win = ui.Window("Canvas.sync example", "fixed", 320, 240) win:show() local c = ui.Canvas(win) c.align = "all" c.pos = -100 c.font = "Impact" c.fontsize = 24 c.color = 0xA2D2FFFF c.sync = true -- Uses internal timer for 30fps drawing function c:onPaint() c:print("Hello World !", c.pos, 20) c.pos = c.pos + 3 if c.pos > win.width then c.pos = -100 end end repeat ui.update() until win.visible == false