我发现有一个 clearRect()
方法,但找不到任何清除圆弧(或整圆)的方法。
有什么方法可以清除 Canvas 中的弧线吗?
最佳答案
没有clearArc
,但是您可以使用复合操作来实现相同的目的
context.globalCompositeOperation = 'destination-out'
根据 MDC,此设置的效果是
The existing content is kept where it doesn't overlap the new shape.
https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Canvas_tutorial/Compositing
因此,任何启用此模式的填充形状最终都会删除当前的 Canvas 内容。
关于javascript - 如何清除 HTML5 canvas 中的圆弧或圆?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3564717/