<canvas width="600" height="400"></canvas>
<script>
function desenharTriangulo(xa, ya, xc, yc, cor) {
var tela = document.querySelector('canvas');
var pincel = tela.getContext('2d');
pincel.fillStyle= cor;
pincel.beginPath();
pincel.moveTo(xa, ya);
pincel.lineTo(xa, yc);
pincel.lineTo(xc, yc);
pincel.fill();
}
desenharTriangulo(50, 50, 400, 400, 'black' );
desenharTriangulo(100, 175, 275, 350, 'white' );
</script>