微信小程序API 绘图createCircularGradient(创建圆形渐变)


本文整理自网络,侵删。

绘图接口和方法


canvasContext.createCircularGradient


定义

创建一个圆形的渐变颜色。

Tip: 起点在圆心,终点在圆环。

Tip: 需要使用addColorStop()来指定渐变点,至少要两个。

参数

参数类型定义
xNumber圆心的x坐标
yNumber圆心的y坐标
rNumber圆的半径

例子

const ctx = wx.createCanvasContext('myCanvas')

// Create circular gradient
const grd = ctx.createCircularGradient(75, 50, 50)
grd.addColorStop(0, 'red')
grd.addColorStop(1, 'white')

// Fill with gradient
ctx.setFillStyle(grd)
ctx.fillRect(10, 10, 150, 80)
ctx.draw()


绘图接口和方法


标签:微信小程序

相关阅读 >>

微信小程序云开发api 查询指令

微信小程序api 实时音视频-创建liveplayercontext对象

微信小程序云开发服务端数据库api update

微信小程序云开发 错误码

微信小程序云开发api 获取集合的引用

微信小程序工具细节点

微信小程序api 数据上报

微信小程序 weuiformpage

微信小程序 getvisitpage

微信小程序 插件服务ocr支持

更多相关阅读请进入《微信小程序》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    暂无评论...