Your browser doesn't support HTML5 canvas.

Concave Polygon Trick

A filled concave polygon can be easily drawn with a triangle fan if an XOR-like blend mode is used. Wherever the polygon crosses itself, its opacity will be toggled. Because the display buffer is always opaque, a transparent surface is used to manage the effect. Only one polygon at a time can be drawn this way. Non-simple polygons will retain holes where they self-intersect.

Download Project