module:Pattern

Background pattern filing

Constructor

new module:Pattern(source, options)

Pattern constructor

Parameters:
NameTypeDescription
sourceHTMLImageElement | Image | HTMLCanvasElement | OffScreenCanvas

Source of the pattern

optionsPatternOptions

Some options

Members

(static) defaultOptions

(static) repetition

height

source

source

width

Methods

toString(ctx) → {CanvasPattern}

Return the pattern object

Parameters:
NameTypeDescription
ctxCanvasRenderingContext2D

Drawing context

Returns:
Type: 
CanvasPattern

Type Definitions

PatternOptions

Type:
  • Object
Properties
NameTypeAttributesDefaultDescription
repeatString<optional>
Pattern.repetition.repeat

Repetition rule

originPositionDefinition<optional>
new Position()

Relative offset

scaleNumber | PositionDefinition<optional>
1

Scaling ratio or a pair of value for horizontal and vertical scaling

PatternRepetitions

Type:
  • Object
Properties
NameTypeDescription
repeatString
xString
yString
noneString