I'm looking for a way to delete a specific line without clearing and redrawing it. How to clear specific line in Canvas : HTML5 I saw this question but everyone said you must clear all the page and redraw. but is there a better way without drawing and clearing?
Asked
Active
Viewed 35 times
-1
-
I don't think so, no. – evolutionxbox May 09 '22 at 15:17
-
thats so bad.now i should work more – alireza May 09 '22 at 15:18
-
I'm pretty sure this is how most rendering works. – evolutionxbox May 09 '22 at 15:19
-
If you are looking for a "shortcut" ... You could use a canvas library like http://fabricjs.com/ that does that for you – Helder Sepulveda May 09 '22 at 15:40
1 Answers
0
There is definitely a way! Try entering the coordinates of the sentences x and y and its width and height. This way you can clear only a portion of canvas. ctx.clearRect() actually clears a rectangle on the canvas and is used to clear the whole canvas by giving it 0 as the x, 0 as the y and giving it the width and height of canvas.

G Jeswin
- 71
- 9