The following script sets the size of the canvas to the size of the browser window it is in:
The important thing here is
var CANVAS_WIDTH = window.innerWidth; var CANVAS_HEIGHT = window.innerHeight;
which gives you the size of the window (=browser).
Plus, you can use the two variables CANVAS_WIDTH and CANVAS_HEIGHT to place stuff inside your canvas.
Was this article helpful? Then please donate to keep The IT Community alive...
If you found this article helpful please share it, comment and help others by writing your own article.
Translate this page:
Articles found in the same category: