private clearCanvas method

This commit is contained in:
Alexander Popov 2023-04-06 14:54:58 +03:00
parent 9b8a7575c2
commit d826bc2426
Signed by: iiiypuk
GPG Key ID: E47FE0AB36CD5ED6
1 changed files with 5 additions and 1 deletions

View File

@ -12,9 +12,13 @@ export class Scene {
this.setScreenSize(width, height);
}
#clearCanvas() {
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
}
run() {
// clear canvas
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
this.#clearCanvas();
// fill canvas
this.context.fillStyle = '#523c4e';