Pattern
See
Constructors
new Pattern()
new Pattern(
options
?):Pattern
Constructor
Parameters
• options?: PatternOptions
Options object
Returns
Defined in
Properties
crossOrigin
crossOrigin:
TCrossOrigin
=''
Default
Defined in
excludeFromExport?
optional
excludeFromExport:boolean
If true, this object will not be exported during the serialization of a canvas
Defined in
id
readonly
id:number
ID used for SVG export functionalities
Defined in
offsetX
offsetX:
number
=0
Pattern horizontal offset from object’s left/top corner
Default
Defined in
offsetY
offsetY:
number
=0
Pattern vertical offset from object’s left/top corner
Default
Defined in
patternTransform?
optional
patternTransform:TMat2D
transform matrix to change the pattern, imported from svgs.
Todo
verify if using the identity matrix as default makes the rest of the code more easy
Default
Defined in
repeat
repeat:
PatternRepeat
='repeat'
Defaults
Defined in
source
source:
CanvasImageSource
The actual pixel source of the pattern
Defined in
type
static
type:string
='Pattern'
Defined in
Accessors
type
get
type():string
Legacy identifier of the class. Prefer using this.constructor.type ‘Pattern’ or utils like isPattern, or instance of to indentify a pattern in your code. Will be removed in future versiones
TODO
add sustainable warning message
set
type(value
):void
Parameters
• value: string
Returns
string
Defined in
Methods
isCanvasSource()
isCanvasSource():
this is Object
Returns
this is Object
true if source is a
Defined in
isImageSource()
isImageSource():
this is Object
Returns
this is Object
true if source is an element
Defined in
sourceToString()
sourceToString():
string
Returns
string
Defined in
toLive()
toLive(
ctx
):null
|CanvasPattern
Returns an instance of CanvasPattern
Parameters
• ctx: CanvasRenderingContext2D
Context to create pattern
Returns
null
| CanvasPattern
Defined in
toObject()
toObject(
propertiesToInclude
?):Record
<string
,any
>
Returns object representation of a pattern
Parameters
• propertiesToInclude?: string
[] = []
Any properties that you might want to additionally include in the output
Returns
Record
<string
, any
>
Object representation of a pattern instance
Defined in
toSVG()
toSVG(
__namedParameters
):string
Returns SVG representation of a pattern
Parameters
• __namedParameters: TSize
Returns
string
Defined in
fromObject()
static
fromObject(__namedParameters
,options
?):Promise
<Pattern
>
Parameters
• __namedParameters: SerializedPatternOptions
• options?: Abortable
Returns
Promise
<Pattern
>