The powered-preview iframe can finish loading while its viewport is
still 0x0 (hidden/animating dialog). Every WebGL example sized its
canvas once at init plus on window resize, so when no resize event is
delivered after the dialog settles, the drawing buffer stays 0x0 and
the preview renders black until something (e.g. opening the plugin-info
panel) changes the iframe width.
Guard each resize handler to no-op when dimensions are unchanged and
call it from the render loop, so the canvas self-heals within one frame
of the iframe getting its real size — no reliance on resize events.
Applies to all 15 webgl-* examples.
Reported by QA: preview stays black until fullscreen/plugin-info is
toggled.
Co-authored-by: Tuola Ge <gexingli@refly.ai>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* feat(examples): add 10 WebGL example templates
Adds 10 first-party powered-preview WebGL examples under plugins/_official/examples,
each a self-contained dir (SKILL.md + example.html + open-design.json, self-contained i18n):
C-tier — faithful Codrops ports (MIT + credit + LICENSE; original imagery):
webgl-depth-gallery, webgl-pixel-reveal-gallery,
webgl-horizontal-parallax, webgl-distortion-grain
D-tier — original self-contained WebGL2 shader heroes (no third-party assets):
webgl-caustic-pool, webgl-halftone-drift, webgl-holographic-foil,
webgl-voronoi-cells, webgl-aurora-veil, webgl-liquid-iridescence
All changed files are <1MB (pass the blob-size gate). The two large mirror
showcases (oryzo, opendesign) are deferred: they exceed the 1MB blob guard and
need their heavy assets moved to repository-assets R2 (per the gate's guidance).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(examples): stop shader setup after WebGL2 fallback message
Wrap each pure-shader example script in an IIFE and return early when
getContext('webgl2') is unavailable, so unsupported environments settle
on the fallback message instead of throwing.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Tuola Ge <gexingli@refly.ai>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>