Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created November 2, 2020 17:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/2f952064533a0d9c211f3297859f502a to your computer and use it in GitHub Desktop.
Save parzibyte/2f952064533a0d9c211f3297859f502a to your computer and use it in GitHub Desktop.
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