On a website, I have a canvas (div) where "code blocks"(form) can be dropped. There's a button that should clear the canvas completely when clicked (so delete all code blocks that are currently in the canvas). How could I do this using JavaScript?
Asked
Active
Viewed 95 times
0
-
https://stackoverflow.com/questions/2142535/how-to-clear-the-canvas-for-redrawing? – Andy May 24 '22 at 13:34
-
Canvas just draws whatever you want, but it loses it's context whenever it's drawn. You either have to save the coordinates of the codeblock to delete those specific ones. But more likely you just want to redraw the background :) – Wimanicesir May 24 '22 at 13:35
-
Please provide enough code so others can better understand or reproduce the problem. – Ethan May 25 '22 at 02:18