Transform
new Konva.Transform(config)
Transform constructor. In most of the cases you don't need to use it in your app. Because it is for internal usage in Konva core. But there is a documentation for that class in case you still want to make some manual calculations.
Parameters
Name | Type | Description |
---|---|---|
m (optional) | Array | Optional six-element matrix |
Own Methods
copy()
Copy Konva.Transform object
Returns: Konva.Transform
Example:
const tr = shape.getTransform().copy()
point(point)
Transform point
Parameters:
point
(Object): 2D point(x, y)
Returns: Object
2D point(x, y)
translate(x, y)
Apply translation
Parameters:
x
(Number)y
(Number)
Returns: Konva.Transform
scale(sx, sy)
Apply scale
Parameters:
sx
(Number)sy
(Number)
Returns: Konva.Transform
rotate(rad)
Apply rotation
Parameters:
rad
(Number): Angle in radians
Returns: Konva.Transform
getTranslation()
Returns the translation
Returns: Object
2D point(x, y)
skew(sx, sy)
Apply skew
Parameters:
sx
(Number)sy
(Number)
Returns: Konva.Transform
multiply(matrix)
Transform multiplication
Parameters:
matrix
(Konva.Transform)
Returns: Konva.Transform
invert()
Invert the matrix
Returns: Konva.Transform
getMatrix()
return matrix
decompose()
convert transformation matrix back into node's attributes
Returns: Konva.Transform