+ 14
Resizing the canvas with Just css stretches it and colors fade... do something like this in js :
canv.style.width=canv.style.height=(canv.width=canv.height=50)+"px"
+ 2
This is how I do my canvases:
W = window.innerWidth;
H = window.innerHeight;
can.width = W;
can.height = H;
And then I always specify what color I want with the exact rgb values and not css color strings, like "black": ctx.rect(0, 0, W, H); ctx.fillStyle = rgba(0, 0, 0, 1); ctx.fill();
Here is an example:
https://code.sololearn.com/W9f3WEndfkNk