You can do this, but not use the clip. A clip only works with paths, and text is not a path.
To achieve the effect, you will need a second canvas in memory (not on the page). Here's how:
- Create a canvas in memory, set its width and height, which may contain text
- Draw text on this canvas in mind
- set the context in the memory of globalCompositeOperation to "source"
- Draw the thing you want to copy to text
- use
drawImage(in-memory-canvas, x, y) to place the newly created effect on your regular canvas.
Simon sarris
source share