x = container.value.scrollLeft - 25 const y = container.value.scrollTop - 25 const canvas = getElementById('canvas') canvas.style.transform = `translate(${x}px, ${y}px)` }) Canvas (Infinite) Scroll ͷΈ <div id="container"> <div class="large-box"> <canvas id="canvas"/> </div> </div> #container { width: 300px; height: 300px; overflow: scroll; } .large-box { width: 5000px; height: 5000px; } canvas { width: 350px; height: 350px; }