(function() {
var myCanvas =
document.getElementById("my_canvas");
var context = myCanvas.getContext("2d");
//context.translate(150,50);
// context.rotate(10.Math.PI/180);
// context.scale(2,2);
context.fillStyle = "red";
context.shadowBlur = 10;
context.shadowColor = "black";
context.save();
context.fillRect(50, 50, 100, 50);
context.fillStyle = "blue";
context.shadowBlur = 5;
context.shadowColor = "black";
context.fillRect(50, 120, 100, 50);
context.restore();
context.fillRect(50, 190, 100, 50);
})();
<canvas id="my_canvas" width="300" height="300" style=" border:solid gray 2px;"></canvas>