darlk
11/15/2016 - 7:38 AM

bBevPJ

bBevPJ

canvas {border: 1px solid black};
function draw() {
	var canvas = document.getElementById("demo");
  if (canvas.getContext){
  	var ctx = canvas.getContext('2d');
    
     ctx.fillStyle = "rgb(200,0,0)";
     ctx.fillRect (10, 10, 50, 50);

     ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
     ctx.fillRect (30, 30, 50, 50);
  }
}
<body onLoad="draw();">
  <canvas id = "demo" width=150 height=150></canvas>
</body>