Pattern
Defined in: src/Pattern/Pattern.ts:20
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Pattern(
options?
):Pattern
Defined in: src/Pattern/Pattern.ts:91
Constructor
Parameters
Section titled “Parameters”options?
Section titled “options?”Options object
Returns
Section titled “Returns”Pattern
Properties
Section titled “Properties”crossOrigin
Section titled “crossOrigin”crossOrigin:
TCrossOrigin
=''
Defined in: src/Pattern/Pattern.ts:60
excludeFromExport?
Section titled “excludeFromExport?”
optional
excludeFromExport:boolean
Defined in: src/Pattern/Pattern.ts:78
If true, this object will not be exported during the serialization of a canvas
readonly
id:number
Defined in: src/Pattern/Pattern.ts:84
ID used for SVG export functionalities
offsetX
Section titled “offsetX”offsetX:
number
=0
Defined in: src/Pattern/Pattern.ts:49
Pattern horizontal offset from object’s left/top corner
offsetY
Section titled “offsetY”offsetY:
number
=0
Defined in: src/Pattern/Pattern.ts:55
Pattern vertical offset from object’s left/top corner
patternTransform?
Section titled “patternTransform?”
optional
patternTransform:TMat2D
Defined in: src/Pattern/Pattern.ts:67
transform matrix to change the pattern, imported from svgs.
verify if using the identity matrix as default makes the rest of the code more easy
repeat
Section titled “repeat”repeat:
PatternRepeat
='repeat'
Defined in: src/Pattern/Pattern.ts:43
Defaults
Section titled “Defaults”source
Section titled “source”source:
CanvasImageSource
Defined in: src/Pattern/Pattern.ts:72
The actual pixel source of the pattern
static
type:string
='Pattern'
Defined in: src/Pattern/Pattern.ts:21
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get type():
string
Defined in: src/Pattern/Pattern.ts:31
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
add sustainable warning message
Returns
Section titled “Returns”string
Set Signature
Section titled “Set Signature”set type(
value
):void
Defined in: src/Pattern/Pattern.ts:35
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Methods
Section titled “Methods”isCanvasSource()
Section titled “isCanvasSource()”isCanvasSource():
this is { source: HTMLCanvasElement }
Defined in: src/Pattern/Pattern.ts:108
Returns
Section titled “Returns”this is { source: HTMLCanvasElement }
true if source is a
isImageSource()
Section titled “isImageSource()”isImageSource():
this is { source: HTMLImageElement }
Defined in: src/Pattern/Pattern.ts:99
Returns
Section titled “Returns”this is { source: HTMLImageElement }
true if source is an element
sourceToString()
Section titled “sourceToString()”sourceToString():
string
Defined in: src/Pattern/Pattern.ts:112
Returns
Section titled “Returns”string
toLive()
Section titled “toLive()”toLive(
ctx
):null
|CanvasPattern
Defined in: src/Pattern/Pattern.ts:125
Returns an instance of CanvasPattern
Parameters
Section titled “Parameters”CanvasRenderingContext2D
Context to create pattern
Returns
Section titled “Returns”null
| CanvasPattern
toObject()
Section titled “toObject()”toObject(
propertiesToInclude?
):Record
<string
,any
>
Defined in: src/Pattern/Pattern.ts:146
Returns object representation of a pattern
Parameters
Section titled “Parameters”propertiesToInclude?
Section titled “propertiesToInclude?”string
[] = []
Any properties that you might want to additionally include in the output
Returns
Section titled “Returns”Record
<string
, any
>
Object representation of a pattern instance
toSVG()
Section titled “toSVG()”toSVG(
__namedParameters
):string
Defined in: src/Pattern/Pattern.ts:166
Returns SVG representation of a pattern
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”Returns
Section titled “Returns”string
fromObject()
Section titled “fromObject()”
static
fromObject(__namedParameters
,options?
):Promise
<Pattern
>
Defined in: src/Pattern/Pattern.ts:192
Parameters
Section titled “Parameters”__namedParameters
Section titled “__namedParameters”options?
Section titled “options?”Returns
Section titled “Returns”Promise
<Pattern
>