December 2010
Intermediate to advanced
110 pages
2h 31m
English
CRC.createPattern() — creates a pattern of tiled images
CanvasPattern createPattern(image, StringrepetitionStyle)
imageThe image to be tiled, specified as an
<img>,
<canvas>, or
<video> tag, or as an offscreen image
created with the Image() constructor.
repetitionStyleSpecifies how the image is tiled. The possible values are in the following table:
| Value | Meaning |
|---|---|
"repeat" | Tile the image in both directions. This is the default. |
"repeat-x" | Tile the image in the X dimension only. |
"repeat-y" | Tile the image in the Y dimension only. |
"no-repeat" | Do not tile the image; use it only a single time. |
A CanvasPattern object representing the pattern.
This method creates and returns a CanvasPattern object that
represents the pattern defined by a tiled image. To use a pattern for
stroking lines or filling areas, use a CanvasPattern object as the value
of the strokeStyle or fillStyle
properties.
Read now
Unlock full access