Tutorialspoint

HTML canvas strokeRect() Method

<!DOCTYPE html>
<html>
   <body>
      <canvas id="newCanvas" width="550" height="400" style="border:2px solid orange;"></canvas>
      <script>
         var c = document.getElementById("newCanvas");
         var ctx = c.getContext("2d");
         ctx.strokeRect(120, 120, 220, 120);
      </script>
   </body>
</html>

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.