<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Esquadro 2</title>
</head>
<body>
<!-- esquadro.html -->
<canvas width="600" height="400"></canvas>
<script>
var tela = document.querySelector('canvas');
var context = tela.getContext('2d');
function desenhaEsquadro(xa, ya, xc, yc, cor) {
context.fillStyle=cor;
context.beginPath();
context.moveTo(xa, ya);
context.lineTo(xa, yc);
context.lineTo(xc, yc);
context.fill();
}
desenhaEsquadro(50,50,400,400, 'black')
desenhaEsquadro(100,175,275,350, 'white')
</script>
</body>
</html>