Wednesday, September 11, 2013

Star Figure

<!DOCTYPE HTML>
<html>
  <head>
    <style>
      body {
        margin: 0px;
        padding: 0px;
      }
    </style>
  </head>
  <body>
    <canvas id="myCanvas" width="600" height="600"></canvas>
    <script>
      var canvas = document.getElementById('myCanvas');
      var context = canvas.getContext('2d');

      context.beginPath(); // START A SHAPE
      context.moveTo(0, 0); // MOVE TO STARTING POINT
      context.lineTo(200, 500);
      context.lineTo(400, 50);
       context.lineTo(60, 400);
       context.lineTo(600, 400);
       context.closePath();
      
      context.stroke();
    </script>
  </body>
</html>

No comments:

Post a Comment