微信小程序API 绘图beginPath(开始一个路径)


本文整理自网络,侵删。

绘图接口和方法

canvasContext.beginPath


定义

开始创建一个路径,需要调用fill或者stroke才会使用路径进行填充或描边。

Tip: 在最开始的时候相当于调用了一次beginPath()

Tip: 同一个路径内的多次setFillStyle()setStrokeStyle()setLineWidth()等设置,以最后一次设置为准。

例子

const ctx = wx.createCanvasContext('myCanvas')
// begin path
ctx.rect(10, 10, 100, 30)
ctx.setFillStyle('yellow')
ctx.fill()

// begin another path
ctx.beginPath()
ctx.rect(10, 40, 100, 30)

// only fill this rect, not in current path
ctx.setFillStyle('blue')
ctx.fillRect(10, 70, 100, 30)

ctx.rect(10, 100, 100, 30)

// it will fill current path
ctx.setFillStyle('red')
ctx.fill()
ctx.draw()


绘图接口和方法


标签:微信小程序

相关阅读 >>

微信小程序云开发api 获取数据库的引用

微信小程序api 绘图setshadow(设置阴影样式)

微信小程序api 生物认证

微信小程序api 转发 (page.onshareappmessage)

微信小程序云开发sdk文档 微信支付关闭订单

微信小程序 wxml

微信小程序 运力方使用onorderadd

微信小程序api 图片-压缩图片接口

微信小程序 服务端接口-商品管理接口

微信小程序api 订阅消息

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




打赏

取消

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

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

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

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

评论

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