When the canvas has a transform applied, let's say context.translate( 10, 10 ) then the clearing will be off by 10 pixels as it's done via context.clearRect( 0, 0, canvas.width, canvas.height ).
A simple workaround is canvas.width = canvas.width though less performant.
Another solution would be:
context.save();
context.setTranfsorm( 1, 0, 0, 1 0, 0 );
context.clearRect( canvas.width, canvas.height );
context.restore();
When the canvas has a transform applied, let's say
context.translate( 10, 10 )then the clearing will be off by 10 pixels as it's done viacontext.clearRect( 0, 0, canvas.width, canvas.height ).A simple workaround is
canvas.width = canvas.widththough less performant.Another solution would be: