Answer the question
In order to leave comments, you need to log in
How to make canvas stretch?
How to make the canvas stretch and all the elements on it too? That is, how in io games in them the game adapts to the monitor. How to do the same? What would be not only the canvas but also the pictures? And the interface elements?
Answer the question
In order to leave comments, you need to log in
const resize = () => {
[canvas.width, canvas.height] = [innerWidth, innerHeight];
};
const init = () => {
resize();
};
window.addEventListener('DOMContentLoaded', init);
window.addEventListener('resize', resize);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question