Before we mentioned the red rectangles drawn in the JS code, we now use the code to see what it means. The code is as follows
Varcontext=c.getcontext ("2d");
Context.fillstyle= "#FF0000";
Context. FillRect (0,0,150,75);
</script>
in fact, a slightly stronger understanding of the small partner should be seen, in the first row is to get the canvas object, and the second row of the GetContext ("2d") object is built-in HTML5 object, with a variety of drawing paths, rectangles, circles, Characters and how to add images. It is obvious that we are using the most primitive 2D method here. The third line is the fill color for the drawing, and the format is no different from the normal CSS style. and the Forth line is the internal parameter of the graph, 4 parameters we use (a,b,c,d) to represent each other. Where A, B is the coordinate of the upper left corner of the rectangle in this example, and the c,d is the rectangle's length and width. Some of the specific things can be asked to consult the brochure, thank you.
Getting started explaining HTML5 's canvas features (2)