Home >Web Front-end >H5 Tutorial >Solution to the problem of html5 canvas fillRect coordinates and size_html5 tutorial skills

Solution to the problem of html5 canvas fillRect coordinates and size_html5 tutorial skills

WBOY
WBOYOriginal
2016-05-16 15:48:221467browse

fillRect(100,100,100,100) The first two 100s refer to the coordinates, and the last two 100s refer to the width and height.

Today I was learning HTML5 canvas and found that the coordinates and size of fillRect were always wrong. After studying for a long time, I found that the width and height of canvas must be inline in the canvas tag. I was depressed for a long time.

Wrong way 1:

Copy the code
The code is as follows:





Document