module:Pattern

module:Pattern

Background pattern filing

Constructor

# new module:Pattern(source, options)

Pattern constructor

Parameters:
Name Type Description
source HTMLImageElement | Image | HTMLCanvasElement | OffScreenCanvas

Source of the pattern

options PatternOptions

Some options

Members

# (static) defaultOptions

# (static) repetition

# height

# source

# source

# width

Methods

# toString(ctx) → {CanvasPattern}

Return the pattern object

Parameters:
Name Type Description
ctx CanvasRenderingContext2D

Drawing context

Returns:
Type
CanvasPattern

Type Definitions

# PatternOptions

Type:
  • Object
Properties
Name Type Attributes Default Description
repeat String <optional>
Pattern.repetition.repeat

Repetition rule

origin PositionDefinition <optional>
new Position()

Relative offset

scale Number | PositionDefinition <optional>
1

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

# PatternRepetitions

Type:
  • Object
Properties
Name Type Description
repeat String
x String
y String
none String