KITASENJU DESIGN BLOG

memo, html, javascript, unity

Is there clearRect on p5js ?

I could not find any function like "clearRect" on p5js. Maybe I have to use "erase" function in p5js. But you can use "clearRect" with context2D easily.

with context2D

let ctx:CanvasRenderingContext2D = this._p5.drawingContext;
ctx.clearRect(xx,yy,ww,hh);

Erase function on p5js

this._p5.erase();
this._p5.fill(0);
this._p5.noStroke();
this._p5.rect(
            xx,yy,ww,hh
);        
this._p5.noErase();
"FOOTER"