Canvas:flip()method


Flips the back buffer, displaying it on the Canvas.

Return value

This function returns no value.

Example

--! luart-extensions import ui require "canvas" -- create a simple Window local win = ui.Window("Canvas.flip() sample", "fixed", 320, 200) -- create a Canvas local canvas = ui.Canvas(win) canvas.align = "all" local x = 160 local y = 100 function win:onKey(key) if key == "VK_UP" then y = y - 4 elseif key == "VK_DOWN" then y = y + 4 elseif key == "VK_LEFT" then x = x - 4 elseif key == "VK_RIGHT" then x = x + 4 end end function canvas:onPaint() self:begin() self:clear() self:fillcircle(x, y, 5, 0xA0D0A0) self:flip() end await win:showasync()