rough-stuff/rough

How to clear the canvas?

Opened this issue · 2 comments

image
image

I want to clear the rectangle drawn before, but it says ‘rc.clearRect is not a function’

image
Probably to use 'rc.ctx'?

rc.ctx is not a documented property so you should not rely on that.

you have the reference to the canvasElement and can get the context yourself. In your code, you have the canvasEle

const canvasEle = document.getElementById('canvas');
const ctx = canvasEle.getContext('2d');
ctx.clearRect(.....)