javascript canvas methods include: createLinearGradient(), createPattern(), rect(), fillRect(), fill(), stroke(), clip(), arc(), arcTo(), etc.
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
The
However, the
The getContext() method returns an object that provides methods and properties for drawing on the canvas.
Color, style and shadow
Method | Description |
---|---|
createLinearGradient() | Creates a linear gradient (for use on canvas content). |
createPattern() | Repeat the specified element in the specified direction. |
createRadialGradient() | Create a radial/circular gradient (used on canvas content). |
addColorStop() | Specifies the color and stop position in the gradient object. |
Rectangle
Description | |
---|---|
Create a rectangle. | |
Draw a "filled" rectangle. | |
Draw a rectangle (without fill). | |
Clears the specified pixels within the given rectangle. |
Path
Description | |
---|---|
Fill the current drawing (path). | |
Draw the defined path. | |
Start a path, or reset the current path. | |
Move the path to the specified point in the canvas without creating a line. | |
Create a path from the current point back to the starting point. | |
Adds a new point and creates a line in the canvas from that point to the last specified point. | |
Clip an area of any shape and size from the original canvas. | |
Create a quadratic Bezier curve. | |
Create a cubic Bezier curve. | |
Creates an arc/curve (used to create a circle or partial circle). | |
Create an arc/curve between two tangent lines. | |
Returns true if the specified point is in the current path, false otherwise. |
Conversion
Description | |
---|---|
Scale the current drawing to a larger or smaller size. | |
Rotate the current drawing. | |
Remaps the (0,0) position on the canvas. | |
Replaces the current transformation matrix of the drawing. | |
Reset the current transformation to the identity matrix. Then run transform(). |
fillText() | |
---|---|
strokeText() | |
measureText() | |
##Method
drawImage() | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Pixel operations
|
The above is the detailed content of What are the javascript canvas methods?. For more information, please follow other related articles on the PHP Chinese website!