微信小程序API 绘图stroke(对当前路径进行描边)


本文整理自网络,侵删。

绘图接口和方法

canvasContext.stroke


定义

画出当前路径的边框。默认颜色色为黑色。

Tip:stroke()描绘的的路径是从beginPath()开始计算,但是不会将strokeRect()包含进去,详情见例二。

例子

const ctx = wx.createCanvasContext('myCanvas')
ctx.moveTo(10, 10)
ctx.lineTo(100, 10)
ctx.lineTo(100, 100)
ctx.stroke()
ctx.draw()


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

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

// only stoke this rect, not in current path
ctx.setStrokeStyle('blue')
ctx.strokeRect(10, 70, 100, 30)

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

// it will stroke current path
ctx.setStrokeStyle('red')
ctx.stroke()
ctx.draw()


绘图接口和方法


标签:微信小程序

相关阅读 >>

微信小程序api 实时语音-取消监听视频状态变化事件

微信小程序 运维中心getjserrsearch

微信小程序api 下拉刷新

微信小程序 订阅消息getcategory

微信小程序 注释

微信小程序 工具库类国际化

微信小程序云开发服务端数据库api 指定筛选条件

微信小程序云开发api get方法

微信小程序api 背景

微信小程序 快递接口(商家查看)-下载打单软件

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




打赏

取消

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

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

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

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

评论

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