html5-canvas Clear canvas using composite operation


Example

Clear the canvas using compositing operation. This will clear the canvas independent of transforms but is not as fast as clearRect().

ctx.globalCompositeOperation = 'copy';

anything drawn next will clear previous content.