Sunday, September 1, 2013

Assignment 01D.)

<!DOCTYPE HTML>
<html>
  <head>
    <style>
      body {
        margin: 0px;
        padding: 0px;
      }
      #myCanvas {
        border: 2px solid rgb(0,255,0);
      }
    </style>
    <script>
      window.onload = function() {
        var canvas = document.getElementById("myCanvas");
        var context = canvas.getContext("2d");
/////////////////////////////////////////

        var Xc = 600;
        var Yc = 300;
        var radius = 50;
        var theta = 0;
        context.beginPath();
        context.arc(Xc, Yc, radius, 0, 2*Math.PI, false);
        context.fillStyle = grd;
        var grd = context.createLinearGradient(500,300,700,300);
        grd.addColorStop(0, "#ffff00");
        grd.addColorStop(1, "#0000ff");
        context.fillStyle = grd;
        context.fill();
        context.lineWidth = 0;
        context.strokeStyle = none;
        context.stroke();

//////////////////////////////////////////
      };

    </script>
  </head>
  <body>
    <canvas id="myCanvas" width="800" height="600"></canvas>
  </body>
</html>


No comments:

Post a Comment