美文网首页
2020-03-30 canvas使用注意事项

2020-03-30 canvas使用注意事项

作者: 夜色001 | 来源:发表于2020-03-30 14:30 被阅读0次

1、画线段的时候,要加上benginPath、closePath,进行路径重置,否则后续可能会受到线条叠加影响,出现意想不到的问题。

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