- 1

When using canvas in html when you use the function ctx.fillRect(x,y,w,h); where is the x and y located in the created rectangle

X and Y position of canvas rectangle

10th May 2017, 5:38 PM
Cooper Allen
Cooper Allen - avatar
2 odpowiedzi
+ 6
x, y starts at the top left corner of the canvas (0,0) --------------------------> | | | | | V ctx.fillRect(40,20,10,20); can't guarantee accuracy >:p --------------------------> | (40,20) | |||||| ^ h | |||||| v | <w> | V
10th May 2017, 6:40 PM
Burey
Burey - avatar
+ 1
x and y are located inside your canvas.
10th May 2017, 5:47 PM
MR Programmer
MR Programmer - avatar