I have two blocks in HTML5 canvas.
- Blue Block ie fixed in the canvas
- Yellow Block that can be dragged with mouse.
When someone moves the yellow block over blue block, I want to change the color of overlapping or intersection regions to green. (please see attached image to have clear idea)

Since blue + yellow = green, is there any way to achieve this by changing the opacity level of blocks or I have to search for the overlapping area of the two blocks and display green block in that area or is there any other way?
I would like to know what is the best approach to achieve this?
Have a look at canvas globalCompositeOperation. The lighter composite type seems to fit what you’re after.