Core HTML

The Canvas Tag

HTML supports the canvast tag for drawing graphics in HTML 5.

Canvas.html

<!DOCTYPE html>
<html>
  <head>
    <title>XoaX.net - Canvas</title>
  </head>
  <body>
    <canvas id="MyCanvas" width="640" height="480" style="border:4px solid #665544;">
    The canvas tag is not supported in your browser.
    </canvas>
    <script>
      var qCanvas = document.getElementById("MyCanvas");
      var qContext = qCanvas.getContext("2d");
      qContext.strokeStyle = "#aa8844";
      qContext.lineWidth = 20;
      qContext.fillStyle = "#aabb88";
      qContext.beginPath();
      qContext.arc(320, 240, 200, 0, 2*Math.PI);
      qContext.closePath();
      qContext.stroke();
      qContext.fill();
    </script>
  </body>
</html>
 

Output

XoaX.net - Canvas The canvas tag is not supported in your browser.
 
 

© 2007–2024 XoaX.net LLC. All rights reserved.