clipping canvas elemetns code example
Example: javascript canvas clip rectangle
ctx.rect(50, 20, 200, 120); // Create path
ctx.clip(); // Clip, everything outside rectangle is not rendered
ctx.rect(50, 20, 200, 120); // Create path
ctx.clip(); // Clip, everything outside rectangle is not rendered