const canvas = document.querySelector("#canvas"); function handleResize() { requestAnimationFrame(() => { canvas.width = window.innerWidth; canvas.height = window.innerHeight; }); } handleResize(); window.addEventListener("resize", handleResize, { passive: true });