function draw() {
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
// assign gradients to fill and stroke styles
ctx.fillStyle = 'rgba(0,0,0,0)'; // or 'transparent'
ctx.fillRect(50,25,50,100);
// setting fillStyle to anything other than 'transparent' will fix this case.
// ctx.fillStyle = 'red';
ctx.strokeStyle = 'green';
ctx.lineWidth = 5;
ctx.beginPath();
ctx.moveTo(canvas.width/4, canvas.height/2);
ctx.lineTo(canvas.width *3/8, canvas.height * 3/4);
ctx.lineTo(canvas.width * 3/4, canvas.height /4);
ctx.stroke();
}