Canvas:skew(anglex, angley, [ centerx, centery] ) method
Applyies a skew transformation on the Canvas
Canvas transformations are cumulative. Remember that the order of method calls (scale()
, translate()
...) must be the opposite of the order of the desired transformation.
Parameters
anglex
A number representing the x-axis skew angle in degrees.
angley
A number representing the y-axis skew angle in degrees.
[centerx, centery]
Two numbers representing the coordinates for the skewing center point, defaulting to the center of the Canvas.
Return value
This function returns no value.
Example
local ui = require "ui"
require "canvas"
local win = ui.Window("Canvas - Skew example", "fixed", 150, 150)
local c = ui.Canvas(win)
c.align = "all"
c.color = 0xd01000ff
local skew = 0
-- Uses internal timer for 30fps drawing
function c:onPaint()
self:begin()
self:clear(0xffffffff)
c:identity()
c:skew(skew, 0)
c:fillrect(50,50,100,100, 0x37A0D7)
skew = skew + 0.1
self:flip()
end
ui.run(win):wait()