A canvas fillRect, strokeRect and clearRect example

function canvasReady() {
  drawShape(document.getElementById('canvas'));
}
function drawShape(canvas){
  if (canvas.getContext){
    var ctx = canvas.getContext('2d');
      ctx.translate(-10, 5);
      ctx.scale(1.2, 0.8);
      ctx.rotate(5 * Math.PI / 180);
    ctx.fillRect(25,25,100,100);
    ctx.clearRect(45,45,60,60);
    ctx.strokeRect(50,50,50,50);
  } else {
    alert('You need Safari or Firefox 1.5+ to see this demo.');
  }
}