运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,暗/亮
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>HTML5 Canvas scale()</h1> <canvas id="myCanvas" width="300" height="150" style="border:1px solid grey"> Sorry, your browser does not support canvas. </canvas> <script> const canvas = document.getElementById("myCanvas"); const ctx = canvas.getContext("2d"); ctx.strokeRect(5, 5, 25, 25); ctx.scale(2, 3); ctx.strokeStyle = "blue"; ctx.strokeRect(5, 5, 25, 25); </script> </body> </html>