Name
CRC.createPattern() — creates a pattern of tiled images
Synopsis
CanvasPattern createPattern(image
, StringrepetitionStyle
)
Arguments
image
The image to be tiled, specified as an
<img>
,<canvas>
, or<video>
tag, or as an offscreen image created with theImage()
constructor.repetitionStyle
Specifies 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.
Returns
A CanvasPattern object representing the pattern.
Description
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.
See Also
Get Canvas Pocket Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.