设置阴影样式。
tip: 如果没有设置,offsetx 默认值为0, offsety 默认值为0, blur 默认值为0,color 默认值为black
。
参数 | 类型 | 范围 | 定义 |
---|---|---|---|
offsetx | number | 阴影相对于形状在水平方向的偏移 | |
offsety | number | 阴影相对于形状在竖直方向的偏移 | |
blur | number | 0~100 | 阴影的模糊级别,数值越大越模糊 |
color | color | 阴影的颜色 |
const ctx = wx.createcanvascontext('mycanvas')
ctx.setfillstyle('red')
ctx.setshadow(10, 50, 50, 'blue')
ctx.fillrect(10, 10, 150, 75)
ctx.draw()