Class: StylePattern
图案填充样式
js
let pattern = new StylePattern('./assets/img/pattern.jpg', 'repeat');
node.css({
fillStyle: pattern
})
Hierarchy
StyleGradient
↳
StylePattern
Implements
CanvasPattern
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
new StylePattern(imagePath
, repetitionStyle?
)
Parameters
Name | Type |
---|---|
imagePath | string |
repetitionStyle? | any |
Overrides
StyleGradient.constructor
Properties
className
className: string
colors
colors: [number
, string
][]
颜色列表 例如: [[0, 'white'], [1, 'blue']]
例如:[[0, 'white'], [0.5, 'red'], [1, 'blue']]
Inherited from
StyleGradient.colors
dirty
dirty: boolean
= true
Inherited from
StyleGradient.dirty
repetition
repetition: string
重复: 'repeat', 'no-repeat', 'repeat-x', or 'repeat-y'
serializers
serializers: string
[]
Overrides
StyleGradient.serializers
Accessors
image
get
image(): string
Returns
string
set
image(src
): void
Parameters
Name | Type |
---|---|
src | string |
Returns
void
Methods
getStyle
getStyle(): CanvasPattern
Returns
CanvasPattern
Overrides
StyleGradient.getStyle
setTransform
setTransform(transform?
): void
设置将在填充或描边绘制操作期间用于模式的变换矩阵。
Parameters
Name | Type | Description |
---|---|---|
transform? | DOMMatrix2DInit | 可选的 DOMMatrix2DInit 对象,用于定义变换矩阵。 如果未提供,则不执行任何操作。 |
Returns
void
Implementation of
CanvasPattern.setTransform
toJSON
toJSON(): Object
Returns
Object
Inherited from
StyleGradient.toJSON
update
update(): void
Returns
void
Inherited from
StyleGradient.update
fromJSON
Static
fromJSON(json
): any
Parameters
Name | Type |
---|---|
json | any |
Returns
any