Canvas

 Canvas 


The <canvas> tag allows you to create dynamic graphics and animations using JavaScript. You can use the Canvas API to draw shapes, lines, and text, as well as create animations and interactive applications.


<canvas id="myCanvas"></canvas>


<script>

  const canvas = document.getElementById("myCanvas");

  const ctx = canvas.getContext("2d");


  // Draw a rectangle

  ctx.fillStyle = "red";

  ctx.fillRect(10, 10, 50, 50);


  // Draw a circle

  ctx.beginPath();

  ctx.arc(75, 75, 30, 0, 2 * Math.PI);

  ctx.fillStyle = "blue";

  ctx.fill();

</script>

No comments:

Post a Comment

The Importance of Cybersecurity in the Digital Age

 The Importance of Cybersecurity in the Digital Age Introduction: In today's digital age, where technology is deeply intertwined with ev...