I want to draw two objects on the canvas with an opacity of 0.2.
Both items partly overlap. Where they overlap, the opacity will be 0.4, as compared to 0.2 for the non-overlapping parts. i.e. canvas 100w, 100h.
https://jsbin.com/wicigarinu/edit?js,output
ctx.globalAlpha = 0.2;
ctx.beginPath();
ctx.arc(50, 50, 25, 0, 2*Math.PI, false);
ctx.fill();
ctx.closePath();
ctx.beginPath();
ctx.arc(65, 65, 20, 0, 2*Math.PI, false);
ctx.fill();
ctx.closePath();
How would i be able to draw on the same spot, but keep the originally set opacity, even on coordinates where more than 1 fill happens ?