add simple rect

This commit is contained in:
Mylloon 2022-11-07 09:59:36 +01:00
parent fcafe386e0
commit 2cb574430c
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -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
);
};