Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在第一个示例中使用了https://konvajs.org/docs/sandbox/Free_Drawing.html,但也在阶段添加了图像。但是当我删除画线时,图像也被删除了。我该如何解决
该演示globalCompositeOperation = destination-out用于实现擦除功能。globalCompositeOperation影响画布中的所有绘图。
globalCompositeOperation = destination-out
globalCompositeOperation
要解决此问题,您可以Konva.Layer在图像底部使用另一个。
Konva.Layer
每个Konva.Layer都有自己的画布元素。所以它不会受到globalCompositeOperation = destination-out另一层中的形状的影响。