Created
February 24, 2019 16:09
-
-
Save nake89/a5baf72ef7c9e0e959327ccc2e5106a5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class Canvas { | |
constructor(x, y) { | |
this.x = x | |
this.y = y | |
this.canvas = document.createElement("canvas") | |
this.ctx = this.canvas.getContext("2d") | |
document.body.appendChild(this.canvas) | |
this.ctx.fillStyle = "rgb(51, 51, 51)" | |
this.ctx.fillRect(0, 0, x, y) | |
} | |
setColor(color) { | |
this.ctx.fillStyle(color) | |
// console.log(this.ctx) | |
} | |
} | |
let canvas = new Canvas(400, 800) | |
canvas.setColor("#FF0000") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment