运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>HTML5 Canvas</h1> <h2>The miterLimit Property</h2> <canvas id="myCanvas" width="300" height="150" style="border:1px solid grey"></canvas> <p>Try to set the miterLimit to 4 (then, the miter length will exceed the miter limit), and when the lines meet it will be displayed as lineJoin="bevel".</p> <script> const c = document.getElementById("myCanvas"); const ctx = c.getContext("2d"); ctx.lineWidth = 10; ctx.lineJoin = "miter"; ctx.miterLimit = 5; ctx.moveTo(20, 20); ctx.lineTo(50, 27); ctx.lineTo(20, 34); ctx.stroke(); </script> </body> </html>