Answers for "draw rectangle on canvas with mouse"

3

draw rectangle on canvas javascript

//Assuming you have canvas and context (ctx) set up:
ctx.fillStyle = "(enter color)";
ctx.fillRect(x, y, width, height);
//to set up canvas and context:
var canvas = document.getElementById("(enter canvas's id)");
var ctx = canvas.getContext("2d");
Posted by: Guest on November-01-2020

Code answers related to "draw rectangle on canvas with mouse"

Code answers related to "Javascript"

Browse Popular Code Answers by Language