add simple rect
This commit is contained in:
parent
fcafe386e0
commit
2cb574430c
1 changed files with 12 additions and 1 deletions
13
js/main.js
13
js/main.js
|
@ -1,5 +1,16 @@
|
|||
window.addEventListener("load", () => main());
|
||||
|
||||
const main = () => {
|
||||
console.log("Hi!");
|
||||
const cnv = document.getElementById("canvas");
|
||||
const ctx = cnv.getContext("2d");
|
||||
|
||||
const size = 100;
|
||||
|
||||
ctx.fillStyle = "blue";
|
||||
ctx.fillRect(
|
||||
cnv.width / 2 - size / 2,
|
||||
cnv.height / 2 - size / 2,
|
||||
size,
|
||||
size
|
||||
);
|
||||
};
|
||||
|
|
Reference in a new issue