-
-
Save parzibyte/2f952064533a0d9c211f3297859f502a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
draw() { | |
let x = 0, y = 0; | |
for (const row of this.board) { | |
x = 0; | |
for (const point of row) { | |
this.canvasContext.fillStyle = point.color; | |
this.canvasContext.fillRect(x, y, Game.SQUARE_LENGTH, Game.SQUARE_LENGTH); | |
this.canvasContext.restore(); | |
this.canvasContext.strokeStyle = Game.BORDER_COLOR; | |
this.canvasContext.strokeRect(x, y, Game.SQUARE_LENGTH, Game.SQUARE_LENGTH); | |
x += Game.SQUARE_LENGTH; | |
} | |
y += Game.SQUARE_LENGTH; | |
} | |
setTimeout(() => { | |
requestAnimationFrame(this.draw.bind(this)); | |
}, 17) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment