I use all possible methods to clean the canvas, but not good luck. As soon as I click on the canvas, all previous drawings reappear.
Here is the code.
function clearCanvas() { //clickX = []; //clickY = []; //clickDrag = []; //context.clearRect(0, 0, canvas.width, canvas.height); //curColor = colorBlack; //redraw(); //clickX = new Array(); //clickY = new Array(); //clickDrag = new Array(); context.fillStyle = '#faebd7'; context.fillRect(0, 0, canvas.width, canvas.height); canvas.width = canvas.width; //context.beginPath(); };
source share