微信小程序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()


绘图接口和方法


标签:微信小程序

相关阅读 >>

微信小程序云开发sdk文档 文件存储上传本地资源

微信小程序组件 native-component

微信小程序中使用lineto方法增加一个新点

微信小程序 数据类型

微信小程序api 视频-获取详细信息

微信小程序媒体组件 live-player

微信小程序云开发 重要概念

微信小程序 查询线路接口

mina文件结构

微信小程序云开发api 获取集合数据

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




打赏

取消

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

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

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

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

评论

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