画出目今路径的边框。。。。默认颜色色为玄色。。。。
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()
更多微信小程序开发教程,,可以关注。。。。
KESION pp电子软件
KESION pp电子软件是海内领先的在线教育软件及私域社交电商软件服务提供商,,恒久专注于为企业提供在线教育软件及社交电商SaaS平台解决方案。。。。
公司焦点产品云开店SaaS社交电商服务平台、在线教育SaaS服务平台、教育企业数字化SaaS云平台、企微营销助手、私有化自力安排品牌网校和在线教育咨询等。。。。KESION 一直通过手艺立异,,提供产品和服务,,助力企业向数字化转型,,通过科技驱动商业刷新,,让商业变得更智慧!
绘图接口和要领 canvasContext.fill 界说 对目今路径中的内容举行填充。。。。默认的填充色为玄色。。。。 Tip : 若是目今路径没有闭合,, fill() 要体会将起点和终点举行毗连,,然后填充,,详
绘图接口和要领 canvasContext.beginPath 界说 最先建设一个路径,,需要挪用fill或者stroke才会使用路径举行填充或描边。。。。 Tip : 在最最先的时间相当于挪用了一次 beg