How to use strokeRect() to draw an empty box (the box frame) in JavaScript

1 Answer

0 votes
<canvas id="canvas" width="1024" height="600"></canvas>
<script type="text/JavaScript">   

var ctx = document.getElementById('canvas').getContext('2d');
  
ctx.strokeStyle = "purple";
ctx.strokeRect(10, 10, 120, 120);
 

</script>

 



answered May 26, 2016 by avibootz

Related questions

1 answer 2,103 views
1 answer 250 views
1 answer 254 views
1 answer 143 views
...