Removing items from a canvas? #159
-
I wonder if it's possible to remove items previously drawn on a canvas like a circle, a rectangle etc.? I'm thinking of doing some kind of animations. I thought |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
There is some documentation on how to clear the canvas https://ipycanvas.readthedocs.io/en/latest/basic_usage.html#clear-canvas, you'll also see the documentation about save and restore here: https://ipycanvas.readthedocs.io/en/latest/canvas_state.html, those methods do not change any pixel on the canvas. Concerning animations there are examples that you can find on the repo |
Beta Was this translation helpful? Give feedback.
-
Ok, seems like save/restore is like in Postscript/PDF, then. The |
Beta Was this translation helpful? Give feedback.
-
To remove only part of the display, you can use a MultiCanvas with two layers, one for fixed stuff and the other for stuff to remove with clear() |
Beta Was this translation helpful? Give feedback.
There is some documentation on how to clear the canvas https://ipycanvas.readthedocs.io/en/latest/basic_usage.html#clear-canvas, you'll also see the documentation about save and restore here: https://ipycanvas.readthedocs.io/en/latest/canvas_state.html, those methods do not change any pixel on the canvas.
Concerning animations there are examples that you can find on the repo