Advertisement
metalx1000

Rectangle - Basic

Jun 28th, 2013
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 0.76 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3.   <head>
  4.   </head>
  5.   <body>
  6.         <canvas id="MyCanvas" width="600" height="300"></canvas>
  7.  
  8.         <script>
  9.                 var canvas = document.getElementById('MyCanvas');
  10.                 var context = canvas.getContext('2d');
  11.  
  12.         context.beginPath();
  13.         context.rect(50, 25,200, 150);
  14.         context.fillStyle = "Blue";
  15.         context.fill();
  16.         context.lineWidth = 15;
  17.         context.strokeStyle = "red";
  18.         context.stroke();
  19.  
  20.                 context.beginPath();
  21.                 context.rect(100, 50,100, 75);
  22.                 context.fillStyle = "Blue";
  23.                 context.fill();
  24.                 context.lineWidth = 15;
  25.                 context.strokeStyle = "red";
  26.                 context.stroke();
  27.  
  28.         </script>
  29.   </body>
  30. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement