How to draw red rectangle on the canvas in JavaScript

1 Answer

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

var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");

ctx.fillStyle = "#FF0000";
ctx.fillRect(50, 50, 200, 100);

</script>

 



answered May 25, 2016 by avibootz
...