Hi I have created one painting application using HTML5 canvas. In that there are two buttons.One is pencil and another one is eraser. Using pencil i am scribbling something. After that i just want to make the rectangular selection and clear the scribbled items during eraser onclick(Not the whole canvas.Only selected area).Onclick of eraser the pencil is also displaying. How to hide the pencil during onclick of eraser?
Asked
Active
Viewed 39 times
0
-
1Duplicate of http://stackoverflow.com/questions/2142535/how-to-clear-the-canvas-for-redrawing?rq=1 – Techie Apr 27 '16 at 07:03
1 Answers
0
Rectangle
context.clearRect(x,y,w,h);
Or circles
context.beginPath();
context.arc(x,y,r,0,Math.PI*2);
context.fillStyle = "#ffffff";
context.fill();

Tyler Dalton
- 59
- 1
- 6