diff --git a/packages/shader-transitions/src/capture.ts b/packages/shader-transitions/src/capture.ts index 1ec563e2d..c172b2cb3 100644 --- a/packages/shader-transitions/src/capture.ts +++ b/packages/shader-transitions/src/capture.ts @@ -33,6 +33,20 @@ export function captureScene(sceneEl: HTMLElement, bgColor: string): Promise elements (e.g. feTurbulence grain backgrounds), certain + // cross-origin images, and mask/clip-path url() refs can taint the + // output canvas on WebKit. Without these flags, html2canvas throws + // `SecurityError: The operation is insecure` on read-back and every + // shader transition falls through to the hard-cut catch handler — + // observed in Safari + Claude Design's cross-origin iframe sandbox. + // + // useCORS: send CORS headers on same-/cross-origin image fetches. + // allowTaint: proceed even when canvas becomes tainted; the resulting + // canvas is still usable as a WebGL texture via + // gl.texImage2D (no pixel read-back required). + useCORS: true, + allowTaint: true, ignoreElements: (el: Element) => el.tagName === "CANVAS" || el.hasAttribute("data-no-capture"), }); } @@ -41,6 +55,18 @@ export function captureScene(sceneEl: HTMLElement, bgColor: string): Promise