Documentation Index
Fetch the complete documentation index at: https://hyperframes.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
HTML-in-Canvas
The HTML-in-Canvas API (drawElementImage) lets you capture live, rendered DOM elements directly into a canvas at GPU speed. This means you can take any HTML — dashboards, forms, landing pages, app UIs — and render them as textures in WebGL scenes with shaders, 3D transformations, and post-processing effects.
How it works
- Place HTML content inside a
<canvas layoutsubtree>element - The browser renders the HTML children as normal DOM
- Call
ctx.drawElementImage(element, x, y, w, h)to capture the rendered pixels into the canvas - Use the canvas as a Three.js texture, apply shaders, map to 3D geometry
What makes this different
Traditional approaches likehtml2canvas re-parse and re-render the DOM in JavaScript — they’re slow, lossy, and miss CSS features like backdrop-filter, complex shadows, and web fonts. The drawElementImage API uses the browser’s own compositor, so:
- Pixel-perfect — every CSS feature is supported because the browser renders it natively
- GPU-accelerated — captures at 60fps, fast enough for real-time animation
- Live content — the HTML can animate, scroll, and change between captures
- Multiple captures simultaneously — no nesting restrictions, multiple
<canvas layoutsubtree>elements can capture different content in the same composition
Feature detection
Always feature-detect before using the API. Compositions should fall back gracefully for browsers without the flag enabled.Re-capturing every frame
For animated content (scrolling, transitions, counters), calldrawElementImage inside your render loop to update the texture every frame:
Catalog blocks
Install all HTML-in-Canvas blocks at once:| Block | Description | Install |
|---|---|---|
| Liquid Glass | Voronoi glass fracture with parallax reveal | npx hyperframes add vfx-liquid-glass |
| iPhone & MacBook | Real 3D GLTF devices with live HTML screens | npx hyperframes add vfx-iphone-device |
| Text Cursor | Dramatic text reveal with chromatic shadows | npx hyperframes add vfx-text-cursor |
| Portal | Dimension breach with volumetric light | npx hyperframes add vfx-portal |
| Shatter | HTML shatters into glass fragments | npx hyperframes add vfx-shatter |
| Magnetic | Magnetic field particle visualization | npx hyperframes add vfx-magnetic |
| Liquid Background | Organic liquid simulation | npx hyperframes add vfx-liquid-background |