Canvas:rotate(angle, [centerx], [centery])method


Applyies a rotation transformation on the Canvas

Parameters

angle

A number representing the rotation angle in degrees. A positive angle creates a clockwise rotation, and a negative angle creates a counterclockwise rotation.

[centerx]

The horizontal coordinate for the rotation center point, defaulting to the center of the Canvas.

[centery]

The vertical coordinate for the rotation center point, defaulting to the center of the Canvas.

Return value

This function returns no value.

Example

--! luart-extensions import ui require "canvas" local win = ui.Window("Canvas - Rotation example", "fixed", 320, 240) local c = ui.Canvas(win) c.align = "all" local degree = 0 local width = c.width/2 local height = c.height/2 function c:onPaint() self:begin() self:clear() c:rotate(degree) c:fillrect(width-35, height-35, width+35, height+35, 0xA569BDFF) degree = degree + 0.0005 sleep() self:flip() end await win:showasync()