阅读(3834) (10)

微信小程序API 绘图setShadow(设置阴影样式)

2016-12-24 11:42:39 更新

绘图接口和方法绘图接口和方法


canvasContext.setShadow


定义

设置阴影样式。

Tip: 如果没有设置,offsetX 默认值为0, offsetY 默认值为0, blur 默认值为0,color 默认值为black

参数

参数类型范围定义
offsetXNumber 阴影相对于形状在水平方向的偏移
offsetYNumber 阴影相对于形状在竖直方向的偏移
blurNumber0~100阴影的模糊级别,数值越大越模糊
colorColor 阴影的颜色

例子

const ctx = wx.createCanvasContext('myCanvas')
ctx.setFillStyle('red')
ctx.setShadow(10, 50, 50, 'blue')
ctx.fillRect(10, 10, 150, 75)
ctx.draw()


微信小程序 canvas接口和方法绘图接口和方法