Added an Eraser to Canvaspad
Within function load() where ran5 is a toggle to turn Eraser ON or OFF >>
ran5.addEventListener("change",function () {
if(check.checked==true){
var Size = Number(ran1.value);
if(Size==1||Size==2)
Size+=0.5;
ctx.lineWidth = Size;
ctx.globalCompositeOperation="destination-out";
ctx.stroke();
}
if(check.checked!=true){
var Size = ran1.value;
ctx.lineWidth = Size;
console.log(col=ran3.value);
console.log(ctx.strokeStyle=col);
ctx.globalCompositeOperation="source-over";
ctx.stroke();
}
});
ran5 input type: Checkbox CSS Styled to: Toggle

Log in or sign up for Devpost to join the conversation.