JavaScript canvas2d object method: createPattern()
[this page | pdf | back links]
The createPattern() method of the JavaScript
DOM object
returned by the getContext("2d")
method applied to the HTML <canvas>
element repeats a specific element in a specific direction (the element can be
an image, video or another canvas
element).
It has the following
syntax with the following parameters.
context.createPattern(image,
repeatspecification)
|
Parameter
|
Required / Optional
|
Description
|
|
image
|
Required
|
Element to be used in
pattern
|
|
repeatspecification
|
Required
|
Parameter that
specifies how repeating is to be carried out. Can take one of these values:
-
repeat: pattern repeats
both horizontally and vertically
-
repeat-x: pattern only
repeats horizontally
-
repeat-y: pattern only
repeats vertically
-
no-repeat: pattern not
repeated
|
NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)