glass-shard-title
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGlass Shard Title
玻璃碎片标题
Voronoi-cut glass panes fly in from depth, rotating, and land as a tiled silhouette of the headline, then fly out past the camera. Each shard is a Sutherland–Hodgman clip of a jittered blob against its Voronoi cell, so the pieces always cover the type. Glass and matcap surfaces get per-fragment fog; the z-flight is decoupled from the ease so shards visibly traverse it. Tile count 1 gives a single pane.
Composition id: . Duration 12.16 s at 30 fps, 1920×1080.
glass-shard-titleVoronoi 切割的玻璃片从深处飞入、旋转,最后拼贴成标题文字的剪影,再飞越摄像机。每块碎片都是经过抖动的 blob 与其 Voronoi 胞元进行 Sutherland–Hodgman 裁剪的结果,因此碎片总能覆盖住字形。玻璃与 matcap 表面带有逐片元雾效;Z 轴飞行与缓动解耦,使碎片能清晰地穿越雾层。tileCount 为 1 时呈现单块玻璃。
composition id:。时长 12.16 秒 @ 30 fps,分辨率 1920×1080。
glass-shard-titleFiles
文件
- (16 KB)
glass-shard-title.html - (1.6 MB)
assets/ferndale_studio_01_1k.hdr - (65 KB)
assets/fonts/Geist-Bold.ttf - (65 KB)
assets/fonts/Geist-Regular.ttf - (65 KB)
assets/fonts/Geist-SemiBold.ttf - (4 KB)
assets/fonts/Geist-OFL.txt - (37 KB)
assets/fonts/cormorant-garamond.woff2 - (4 KB)
assets/fonts/CormorantGaramond-OFL.txt - (549 KB)
assets/glass-main.js - (1 KB)
assets/Three-LICENSE.txt - (fetched from the CDN at install)
assets/matcap-1.png
- (16 KB)
glass-shard-title.html - (1.6 MB)
assets/ferndale_studio_01_1k.hdr - (65 KB)
assets/fonts/Geist-Bold.ttf - (65 KB)
assets/fonts/Geist-Regular.ttf - (65 KB)
assets/fonts/Geist-SemiBold.ttf - (4 KB)
assets/fonts/Geist-OFL.txt - (37 KB)
assets/fonts/cormorant-garamond.woff2 - (4 KB)
assets/fonts/CormorantGaramond-OFL.txt - (549 KB)
assets/glass-main.js - (1 KB)
assets/Three-LICENSE.txt - (安装时从 CDN 获取)
assets/matcap-1.png
Install
安装
Install with ; by default the files above land under . Then mount the block from the host :
npx hyperframes add glass-shard-titlecompositions/glass-shard-title/index.htmlhtml
<div
data-composition-id="glass-shard-title"
data-composition-src="compositions/glass-shard-title/glass-shard-title.html"
data-start="0"
data-duration="12.16"
data-track-index="1"
data-width="1920"
data-height="1080"
></div>Render with custom values by targeting the composition file directly:
sh
npx --yes hyperframes@0.8.12 render 'compositions/glass-shard-title/glass-shard-title.html' --variables '{"headline":"Designed in glass","tileCount":8}'使用 安装;默认情况下上述文件会放在 下。然后在宿主 中挂载该 block:
npx hyperframes add glass-shard-titlecompositions/glass-shard-title/index.htmlhtml
<div
data-composition-id="glass-shard-title"
data-composition-src="compositions/glass-shard-title/glass-shard-title.html"
data-start="0"
data-duration="12.16"
data-track-index="1"
data-width="1920"
data-height="1080"
></div>通过直接指定 composition 文件,可以使用自定义值渲染:
sh
npx --yes hyperframes@0.8.12 render 'compositions/glass-shard-title/glass-shard-title.html' --variables '{"headline":"Designed in glass","tileCount":8}'Variables
变量
Read at runtime via ; declared on the composition root as (single-quoted attribute, plain JSON).
window.__hyperframes.getVariables()data-composition-variables| id | type | default | label / range |
|---|---|---|---|
| string | | Headline max 40 chars |
| number | | Tiles 1–400 step 1 |
| number | | Roundness (0-1) 0–1 step 0.01 |
| number | | Bevel (0-1) 0–1 step 0.01 |
| number | | Surface smoothness (0-1) 0–1 step 0.01 |
| number | | Fly-in time (s) 0.2–6 step 0.05 |
| number | | Fly-out time (s) 0.2–6 step 0.05 |
| number | | Stagger (0-1) 0–1 step 0.01 |
| number | | Fly-in rotation (0-60) 0–60 step 0.1 |
| number | | Fly-out rotation (0-6) 0–6 step 0.1 |
| number | | Outline chaos (0-1) 0–1 step 0.01 |
| number | | Edge padding (0-1) 0–1 step 0.01 |
| number | | Size variance (0-1) 0–1 step 0.01 |
| number | | Tile gap 0–0.3 step 0.002 |
| number | | Fly-in position ease (1-10) 1–10 step 0.1 |
| number | | Side fly distance 0–60 step 0.5 |
| number | | Z fly-from (negative) -400–0 step 2 |
| number | | Z fly-out to (+ = past camera) -400–60 step 2 |
| number | | Fog distance (0 = off) 0–400 step 2 |
运行时通过 读取;声明在 composition 根元素的 属性上(单引号属性,纯 JSON)。
window.__hyperframes.getVariables()data-composition-variables| id | type | 默认值 | 标签 / 范围 |
|---|---|---|---|
| string | | 标题最多 40 字符 |
| number | | 碎片数 1–400 步长 1 |
| number | | 圆度 0–1 步长 0.01 |
| number | | 倒角 0–1 步长 0.01 |
| number | | 表面平滑度 0–1 步长 0.01 |
| number | | 飞入时间(秒)0.2–6 步长 0.05 |
| number | | 飞出时间(秒)0.2–6 步长 0.05 |
| number | | 错开程度(0-1)0–1 步长 0.01 |
| number | | 飞入旋转(0-60)0–60 步长 0.1 |
| number | | 飞出旋转(0-6)0–6 步长 0.1 |
| number | | 轮廓混乱度(0-1)0–1 步长 0.01 |
| number | | 边缘留白(0-1)0–1 步长 0.01 |
| number | | 大小差异(0-1)0–1 步长 0.01 |
| number | | 碎片间隙 0–0.3 步长 0.002 |
| number | | 飞入位置缓动(1-10)1–10 步长 0.1 |
| number | | 侧面飞行距离 0–60 步长 0.5 |
| number | | Z 轴飞入起始(负值)-400–0 步长 2 |
| number | | Z 轴飞出终点(+ = 越过摄像机)-400–60 步长 2 |
| number | | 雾距离(0 = 关闭)0–400 步长 2 |
Runtime contract
运行时契约
- One paused GSAP timeline registered as .
window.__timelines["glass-shard-title"] - Re-syncs on the CustomEvent; every frame is a closed-form function of time (seeded PRNG only, no rAF loops, no Date.now).
hf-seek - Renderer: three.js 0.181.2 (bundled), GSAP 3.14.2, Canvas 2D, GLSL shaders, HDR environment, Matcap, Seeded PRNG, d3-delaunay, Shadow maps. Budget roughly 350 MB per live instance; run one at a time.
- External runtime dependencies: ,
https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js.https://cdn.jsdelivr.net/npm/d3-delaunay@6.0.4/dist/d3-delaunay.min.js - Local fonts: assets/fonts/Geist-Regular.ttf, assets/fonts/Geist-SemiBold.ttf, assets/fonts/Geist-Bold.ttf.
- Bundled code is inlined into the composition (assets/glass-main.js); rebuild with esbuild and re-inline after editing the .mjs source.
- 一个暂停的 GSAP 时间线注册为 。
window.__timelines["glass-shard-title"] - 在 CustomEvent 上重新同步;每一帧都是时间的闭式函数(仅使用带种子的 PRNG,无 rAF 循环,无 Date.now)。
hf-seek - 渲染器:three.js 0.181.2(已打包)、GSAP 3.14.2、Canvas 2D、GLSL 着色器、HDR 环境、Matcap、带种子 PRNG、d3-delaunay、阴影贴图。每个运行实例约占用 350 MB;一次只运行一个。
- 外部运行时依赖:、
https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js。https://cdn.jsdelivr.net/npm/d3-delaunay@6.0.4/dist/d3-delaunay.min.js - 本地字体:assets/fonts/Geist-Regular.ttf、assets/fonts/Geist-SemiBold.ttf、assets/fonts/Geist-Bold.ttf。
- 打包后的代码会内联到 composition 中(assets/glass-main.js);编辑 .mjs 源码后使用 esbuild 重新构建并再次内联。
Editing rules (from the source project)
编辑规则(来自源项目)
- Keep a single-quoted attribute with plain
data-composition-variablesJSON. Never save it through Studio's Design panel." - Do not put in static markup; create it at runtime.
<canvas> - Keep every visual state a function of t; seek-safety is what makes the block renderable.
- 保持 为单引号属性,内部为普通
data-composition-variablesJSON。切勿通过 Studio 的 Design 面板保存它。" - 不要在静态标记中放置 ;请在运行时创建。
<canvas> - 让所有视觉状态都成为 t 的函数;seek 安全性是 block 可渲染的关键。