I want to enable the user to draw a polygon from lines to create the shape he want and apply transform to it (Rotate and resize).
How to implement it using Konvajs ?
I want to enable the user to draw a polygon from lines to create the shape he want and apply transform to it (Rotate and resize).
How to implement it using Konvajs ?

Making polygons and transforming them is simple with Konva.
See tutorial on Konva.Polygon and Konva.Transformer. Note the polygon tutorial does not cover the process of the user nominating the points. Open another question for that if required.
In Konva a polygon is created from the Konva.Line shape, and is positioned at a specific x,y point that you specify initially. All Konva shapes share this feature.
Often, for polygons, it is easier to leave this set to 0,0. The points of the polygon are stored as a distinct attribute. The first point is interpreted as a move-to command which starts from the polygon x,y position. Subsequent x,y points are treated as draw-to commands thus drawing the lines of the polygon. There is a further closed attribute that is used to close the shape, connecting the last point to the first.
The points are an attribute of the Konva.Line. When we drag the polygon we do not need to change the points since they are drawn in reference to the shape's position attribute.
To create a polygon you must create code that will store points indicated by the user via mouse or touch, and then close the polygon when the user indicates to do so.
All Konva shapes can be visually scaled and rotated using a Konva.Transformer Regarding shape size, the Transformer does not change the width or height shape of the shape - it changes the scale.
Since the Transformer operates on the shape's transformation matrix, and the points are contained within the shape, there is no need to do any word to affect the points for any of the changes that the Transformer introduces.
See this blog post for a wider discussion of the Transformer.