Clear canvas using composite operation
suggest changeClear the canvas using compositing operation. This will clear the canvas independent of transforms but is not as fast as clearRect().
ctx.globalCompositeOperation = 'copy';
The next drawing replaces the whole canvas: pixels it does not cover become transparent. Unlike clearRect, that clear is not limited to the transformed rectangle you draw.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents