【前端可视化】Canvas 绘制图层覆盖了怎么办?

ctx.globalCompositeOperation = 'destination-over';

Canvas 2D API 的 CanvasRenderingContext2D.globalCompositeOperation 属性设置要在绘制新形状时应用的合成操作的类型,其中 type 是用于标识要使用的合成或混合模式操作的字符串。
destination-over:在现有的画布内容后面绘制新的图形。

更多请查看mdn文档:CanvasRenderingContext2D.globalCompositeOperation

猜你喜欢

转载自blog.csdn.net/IAIPython/article/details/131448445