更新时间:2022-12-24 11:37:19
如果你想绘制一个黑色的透明笔划,你可能需要:
If you want to draw a black transparent stroke, you probably want:
context.globalCompositeOperation = "destination-out";
context.strokeStyle = "rgba(0,0,0,1)";
记得保存之前的globalCompositeOperation,稍后再恢复,否则透明度将无法正常工作!
Remember to save the previous globalCompositeOperation and then restore it later or transparency won't work properly!