hs.canvas
which provides support for basic matrix manipulations which can be used as the values for transformation
attributes in the hs.canvas
module.m11
, m12
, m21
, m22
, tX
, and tY
. For those of a mathematical bent, the 3x3 matrix used within this module can be visualized as follows:hs.canvas.matrix.identity() -> matrixObject
hs.canvas.matrix:append(matrix) -> matrixObject
matrix
- the table to append to the current matrix.hs.canvas.matrix:invert() -> matrixObject
hs.canvas.matrix:prepend(matrix) -> matrixObject
matrix
- the table to append to the current matrix.hs.canvas.matrix:rotate(angle) -> matrixObject
angle
- the number of degrees to rotate in a clockwise direction.hs.canvas.matrix.translate(x, y):rotate(angle):translate(-x, -y)
hs.canvas.matrix:scale(xFactor, [yFactor]) -> matrixObject
xFactor
- the scaling factor to apply to the object in the horizontal orientation.yFactor
- an optional argument specifying a different scaling factor in the vertical orientation. If this argument is not provided, the xFactor
argument will be used for both orientations.hs.canvas.matrix:shear(xFactor, [yFactor]) -> matrixObject
xFactor
- the shearing factor to apply to the object in the horizontal orientation.yFactor
- an optional argument specifying a different shearing factor in the vertical orientation. If this argument is not provided, the xFactor
argument will be used for both orientations.hs.canvas.matrix:translate(x, y) -> matrixObject
x
- the distance to translate the object in the horizontal direction.y
- the distance to translate the object in the vertical direction.