当前位置:K88软件开发文章中心编程全书微信小程序 → 文章内容

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

减小字体 增大字体 作者:佚名  来源:网上搜集  发布时间:2019-1-15 15:00:40

由 ?﹏???ζ???﹏﹏? 创建,youj 最后一次修改 2016-12-24 绘图接口和方法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 pathctx.rect(10, 10, 100, 30)ctx.setStrokeStyle('yellow')ctx.stroke()// begin another pathctx.beginPath()ctx.rect(10, 40, 100, 30)// only stoke this rect, not in current pathctx.setStrokeStyle('blue')ctx.strokeRect(10, 70, 100, 30)ctx.rect(10, 100, 100, 30)// it will stroke current pathctx.setStrokeStyle('red')ctx.stroke()ctx.draw()绘图接口和方法

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