0
In the method fillRect(x,y,w,h); , what does (x,y) exactly points to on the rectangle?
var c=document.getElementById("canvas1"); var ctx=c.getContext("2d"); ctx.fillRect(20,20,100,100);
3 Respostas
+ 1
Top left corner
+ 12
x is the x-coordinate of the canvas, and y is the y-coordinate.
The upper-left corner of the canvas has the coordinates (0, 0)
ctx.fillRect(20, 20, 100, 100) means: start at the the position(20, 20) and draw a 100x100 rectangle!
+ 1
Thank you