Filling Line Art, Filled triangle
<!doctype html> <html lang="en"> <body> <div style="position: absolute; top: 50px; left: 50px;"> <canvas id="canvas" width="500" height="500"> Your browser does not support the HTML 5 Canvas. </canvas>//from w ww .ja v a 2 s . c om <script type="text/javascript"> let theCanvas = document.getElementById('canvas'); let context = theCanvas.getContext('2d'); context.fillStyle = "rgba(0, 200, 0, 0.5)"; context.beginPath(); context.moveTo(225, 25); context.lineTo(305, 25); context.lineTo(225, 105); context.closePath(); context.fill(); </script> </div> </body> </html>