微信小程序开发 专题
专题目录
您的位置:微信小程序开发 > 微信小程序开发专题 > 微信小程序API 绘图stroke(对当前路径进行描边)
微信小程序API 绘图stroke(对当前路径进行描边)
作者:--    发布时间:2019-11-20


定义

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

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()


网站声明:
本站部分内容来自网络,如您发现本站内容
侵害到您的利益,请联系本站管理员处理。
联系站长
373515719@qq.com
关于本站:
编程参考手册