Closed tongda closed 1 year ago
If you apply a transformation on the main canvas, do transformation do not apply on the path2d that you draw?
Did you try something that did not work?
It seems that applying a transformation on the main canvas will affect Path2D objects drawn afterwards, not the already drawn ones. However, I want to transform Path2D objects that already drawn on the canvas. Additionally, I want to transform objects individually.
However, I want to transform Path2D objects that already drawn on the canvas
Everything that is drawn on the canvas is not modifiable, it's completely static. You will need to clear the canvas and draw again with your transformation.
For applying individual transformations to your objects, you will have to save
and restore
the canvas state between draws. https://ipycanvas.readthedocs.io/en/latest/canvas_state.html
For applying individual transformations to your objects, you will have to
save
andrestore
the canvas state between draws. https://ipycanvas.readthedocs.io/en/latest/canvas_state.html
I see. Implementing an interactive polygon seems much more complex than I thought.
If you want to animate SVG shapes, you probably would like to have a look at https://github.com/cduck/drawSvg
Great, will look into it. Thank you.
I am trying to build a tools that can draw, move and transform polygons on image using ipycanvas. Is there a way to add transform matrix to Path2D easily?