A visual comparison of HTML-in-Canvas vs rasterizing DOM to a canvas texture (side-by-side below, compare average capture times)
Existing approaches to pull web content into canvas are slow and lossy:
- Animations glitch, or don't play at all
- CSS replication is imprecise
- Clogs up the main thread, other animations lag
HTML-in-Canvas (texElementImage2D) lets the browser's own compositor map CSS layouts, animations, and transitions precisely into canvas/WebGL textures β one native call instead of thousands of JS style reads.
It's currently available behind an experimental Chrome flag.
Really cool, and I can't wait for it to become mainstream.