mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
14 lines
No EOL
570 B
JavaScript
14 lines
No EOL
570 B
JavaScript
document.body.style = "display:flex; min-height:100vh; justify-content: center; align-items: center; margin:0;"
|
|
let canvas = window.canvas = document.createElement("canvas");
|
|
canvas.style = "max-height: 100vh; max-width: 100vw;";
|
|
document.body.append(canvas);
|
|
window.ctx = canvas.getContext("2d");
|
|
let update = () => {
|
|
var density = window.devicePixelRatio;
|
|
window.w = canvas.width = window.innerWidth * density;
|
|
window.h = canvas.height = window.innerHeight * density;
|
|
console.log("canvas", canvas.width, canvas.height)
|
|
|
|
draw();
|
|
}
|
|
(window.onresize = update)() |