From d826bc24262eeec6dd41ad0f22c0bf09ac969eb1 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Thu, 6 Apr 2023 14:54:58 +0300 Subject: [PATCH] private clearCanvas method --- src/js/scene.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/js/scene.js b/src/js/scene.js index fcd03cd..f2d53e6 100644 --- a/src/js/scene.js +++ b/src/js/scene.js @@ -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';