Skip to content Skip to sidebar Skip to footer

How To Clip Canvas With Css Clip-path?

I know that I can clip a canvas by creating a path with getContext('2d') and setting globalCompositeOperation. I've noticed that sometimes I'm able to clip a canvas with -webkit-cl

Solution 1:

I've never worked with -webkit-clip-path:, but just on general principles I'd try, as a workaround, applying the clip path to an element containing the canvas instead of the canvas itself.

 <div class='canvas-wrapper'><canvas></canvas></div>
 .canvas-wrapper {
    display: table;   /* shrinkwrap around canvas */
    -webkit-clip-path: ...;
 }

Post a Comment for "How To Clip Canvas With Css Clip-path?"