May 19, 2021 WeChat Mini Program Development Document
Drawing interfaces and methods
Set the shadow style.
Tip:
If not set, offsetX default is 0, offsetY default is 0, blur default is 0, color default is
black
Parameters | Type | Range | Defined |
---|---|---|---|
offsetX | Number | The offset of the shadow relative to the shape horizontally | |
offsetY | Number | The offset of the shadow relative to the shape in the vertical direction | |
blur | Number | 0~100 | The fuzzy level of the shadow, the larger the value, the more blurry it becomes |
color | Color | The color of the shadow |
const ctx = wx.createCanvasContext('myCanvas')
ctx.setFillStyle('red')
ctx.setShadow(10, 50, 50, 'blue')
ctx.fillRect(10, 10, 150, 75)
ctx.draw()