Shaders / Examples / Title

Title

A title that appears pixel by pixel, in about a second and a half.

Drawn with
Canvas 2D
Chain
tone → ordered → reveal → palette
Code
@forgeron/shaders: builtInPresets()["role-title"]
/01 → What it is
  • A raster scan: rows start top to bottom, each swept left to right; near the slanted front, pixels shift and step ember, dark ember, dim, muted, then ink.
  • The preset is the cell-local form (a `tone` mask through `reveal`); the mount, `mountReveal`, adds the wave and stays.
  • The text is in the page from the start; under reduced motion it simply stays.
/02 → Where Forgeron uses it
SiteWhereSettings
font.forgeron.shSpecimen hero, the title “Forgeron Sans”mountReveal · 1.5 s
/03 → Versions
  • /01 Short titlepixel 10
  • /02 Wordmarkpixel 5
  • /03 Slowpixel 5 · 3000 ms
/04 → Use it
/01 → React
import { PixelReveal } from "@forgeron/ui";

<h1>
  <PixelReveal text="Forgeron" pixel={8} />
</h1>
/02 → Plain DOM
import { mountReveal, textRows } from "@forgeron/ui";

mountReveal(canvas, [textRows("Forgeron"), textRows("Sans")], {
  pixel: 8,
  onDone: () => canvas.remove(),
});
/03 → Preset "role-title" (builtInPresets())
{
  "$schema": "https://shaders.forgeron.sh/schema/preset.v1.json",
  "version": 1,
  "name": "role-title",
  "source": {
    "type": "tone"
  },
  "passes": [
    {
      "type": "ordered",
      "matrix": 8,
      "centered": true,
      "origin": "top",
      "steps": [
        [
          0,
          1
        ]
      ]
    },
    {
      "type": "reveal",
      "duration": 1.5,
      "hold": 1.5,
      "loop": false,
      "front": [
        3,
        2
      ],
      "band": 0.06,
      "dither": 0.12,
      "matrix": 8
    },
    {
      "type": "palette",
      "tones": [
        {
          "var": "--bg",
          "fallback": "#0d0d0d"
        },
        {
          "var": "--line",
          "fallback": "#2b2b2b"
        },
        {
          "var": "--ink-dim",
          "fallback": "#575757"
        },
        {
          "var": "--ink-muted",
          "fallback": "#8c8c8c"
        },
        {
          "var": "--ink",
          "fallback": "#dcdcdc"
        }
      ],
      "transparent": [
        0
      ]
    }
  ]
}
API → Options
OptionTypeDefaultDescription
textstring—One line, in the pixel face's capitals.
pixelnumber8CSS pixels per font pixel.
durationnumber1500Milliseconds; 1.3 to 1.8 s for a hero title.
stillboolean—One frame at t = 0. Without it, the reader's prefers-reduced-motion decides.
replaynumber—Changing it plays the reveal again.