Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<body onload = init();>
<canvas id="myCanvas" width="400" height =800>
  Your browser does not support the canvas tag.</canvas>
</body>
</html>
 
var canvas, ctx;
 
function init() {
  canvas = document.getElementById('myCanvas');
  ctx = canvas.getContext('2d');
  
  setShadow();
  
  // first green filled rectangle
  ctx.fillStyle = "#22FFDD"; // rectangle color
  ctx.fillRect(20, 20, 200, 100); 
  
  // second stroked rectangle
  ctx.strokeStyle = "purple"; // rectangle color
  ctx.lineWidth=10;
  ctx.strokeRect(20, 150, 200, 100); 
}
function setShadow() {
   ctx.shadowColor = "Grey"; // color
   ctx.shadowBlur = 20;           // blur level
   ctx.shadowOffsetX = 15;        // horizontal offset
   ctx.shadowOffsetY = 15;        // vertical offset
}
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
micbuffapro
0viewers