I have a browser strategy game in development and will be implementing a fog of war, which will draw two layers of fog (revealed before, never revealed) over the game map. I have some doubts about performance if I render every fog square on the grid vs. punching a hole.
For punching a hole, I've seen the example in Konva Free Drawing example where I can erase wherever a player has been using the canvas context ...
context.globalCompositeOperation = 'destination-out';
But in the example that erases the whole canvas. I don't know if I can use this with layers. I don't want to erase the map layer, just erase part of the large fog texture I drew as a rect on a layer over the map.
Does anyone have any suggestions or have a working example that would solve this?