Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to 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>