Home > Web Front-end > H5 Tutorial > body text

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

WBOY
Release: 2016-05-16 15:48:22
Original
1447 people have browsed it

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