UNPKG

@fxshelf/glyph-rain

Version:

Matrix-style glyph rain with cursor stir and drop-head lighting for React and Vue. WebGL2, zero animation-lib deps. Copy-as-source friendly.

19 lines (12 loc) • 818 B
# Glyph Rain — 动效说明(专业) ## 管线 1. **Glyph atlas**:把 `charset` 栅格化到 2D canvas,上传为 WebGL2 纹理(mipmap)。 2. **Procedural rain**:片元着色器按列 hash 生成相位、密度门控、拖尾衰减;多层 parallax(最多 3)。 3. **Wake field**:指针位置写入 256×1 `RG32F` 纹理,驱动局部加速与亮度。 4. **Content path(可选)**:若存在 `drawElementImage` / `requestPaint`,把 HTML 子树画进 source canvas,再采样做 dim / 点光 / relief。 ## 关键 - WebGL2、零动画库依赖。 - `prefers-reduced-motion` 时停表、清 wake。 - IntersectionObserver 离开视口停 RAF;ResizeObserver 同步 DPR。 ## 回退 无 html-in-canvas 时 `uHasContent=0`,只输出半透明雨层,子内容仍正常 DOM 渲染。