Class: Transform

Konva. Transform

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.


new Transform( [m])

Parameters:
Name Type Argument Description
m Array <optional>

Optional six-element matrix

Source:
konva.js

Methods


copy()

Copy Konva.Transform object

Source:
konva.js
Returns:
Type
Konva.Transform
Example
const tr = shape.getTransform().copy()

decompose()

convert transformation matrix back into node's attributes

Source:
konva.js
Returns:
Type
Konva.Transform

getMatrix()

return matrix

Source:
konva.js

getTranslation()

Returns the translation

Source:
konva.js
Returns:

2D point(x, y)

Type
Object

invert()

Invert the matrix

Source:
konva.js
Returns:
Type
Konva.Transform

multiply(matrix)

Transform multiplication

Parameters:
Name Type Description
matrix Konva.Transform
Source:
konva.js
Returns:
Type
Konva.Transform

point(point)

Transform point

Parameters:
Name Type Description
point Object

2D point(x, y)

Source:
konva.js
Returns:

2D point(x, y)

Type
Object

rotate(rad)

Apply rotation

Parameters:
Name Type Description
rad Number

Angle in radians

Source:
konva.js
Returns:
Type
Konva.Transform

scale(sx, sy)

Apply scale

Parameters:
Name Type Description
sx Number
sy Number
Source:
konva.js
Returns:
Type
Konva.Transform

skew(sx, sy)

Apply skew

Parameters:
Name Type Description
sx Number
sy Number
Source:
konva.js
Returns:
Type
Konva.Transform

translate(x, y)

Apply translation

Parameters:
Name Type Description
x Number
y Number
Source:
konva.js
Returns:
Type
Konva.Transform