Property:
globalCompositeOperation:
Canvas:
your browser does not support the canvas tag
Code:
const c = document.getElementById('myCanvas');
const ctx = c.getContext('2d');
ctx.fillStyle = 'blue';
ctx.fillRect(10, 10, 50, 50);
ctx.globalCompositeOperation = 'source-atop';
ctx.beginPath();
ctx.fillStyle = 'red';
ctx.arc(50, 50, 30, 0, 2 * Math.PI);
ctx.fill();
Click the property values above to see the result
W3Schools.com - Play it