1、画线段的时候,要加上benginPath、closePath,进行路径重置,否则后续可能会受到线条叠加影响,出现意想不到的问题。
drawLineSegment (ctx, x, y, x1, y1) {
ctx.beginPath()
ctx.moveTo(x, y)
ctx.lineTo(x1, y1)
ctx.closePath()
ctx.stroke()
},
drawLineSegment (ctx, x, y, x1, y1) {
ctx.beginPath()
ctx.moveTo(x, y)
ctx.lineTo(x1, y1)
ctx.closePath()
ctx.stroke()
},
本文标题:2020-03-30 canvas使用注意事项
本文链接:https://www.haomeiwen.com/subject/tflvuhtx.html
网友评论