Reveal
Tones appear along a Bayer-jittered front that scans the rows.
- Drawn with
- GLSL + CPU
- Chain
- field → pixelate → ordered → reveal → palette
- Code
- @forgeron/shaders: revealMeta, revealGlsl, revealCpu
/01 → What it is
- The front goes down the rows, left to right in each row; a cell wears the `front` tones before it settles in its own.
- The cell-local form of the Title example's reveal, which also shifts pixels with a wave.
- Both sides: GLSL and CPU, with the same result. A cell pass.
- CPU against GLSL: tolerance 1 % of pixels (measured 0).
/02 → In the examples
| Example | Chain |
|---|---|
| Title | tone → ordered → reveal → palette |
/03 → Versions
- /01 Live
every setting, on "reveal" - /02 Slow
duration 3
/04 → Use it
{
"type": "reveal",
"duration": 1.5,
"hold": 1.5,
"loop": false,
"front": [
3,
2
],
"band": 0.06,
"dither": 0.12,
"matrix": 8
}import { revealMeta, revealGlsl, revealCpu } from "@forgeron/shaders";
// revealMeta: description and params schema (validation, the editor)
// revealGlsl: the GPU side, for bindChain then glPipeline
// revealCpu: the CPU side, for bindChain then runCpu{
"$schema": "https://shaders.forgeron.sh/schema/preset.v1.json",
"version": 1,
"name": "reveal",
"source": {
"type": "field",
"mode": "globe"
},
"passes": [
{
"type": "pixelate",
"size": 4
},
{
"type": "ordered",
"matrix": 8,
"centered": false,
"origin": "bottom",
"steps": [
[
0,
1
],
[
0.86,
0.12
]
]
},
{
"type": "reveal",
"duration": 1.5,
"hold": 1.5,
"loop": true,
"front": [
2,
1
],
"band": 0.06,
"dither": 0.12,
"matrix": 8
},
{
"type": "palette",
"tones": [
{
"var": "--bg",
"fallback": "#0a0a0a"
},
{
"var": "--ink",
"fallback": "#ededed"
},
{
"var": "--accent",
"fallback": "#ff4f1f"
}
],
"transparent": []
}
]
}import { builtInPresets } from "@forgeron/shaders";
import { mountPreset } from "@forgeron/shaders/dom";
// WebGL2: every step has GLSL. Validated first.
const handle = mountPreset(canvas, builtInPresets()["reveal"]);
// later: handle?.destroy();import { builtInPresets, chainOf, runCpu, toRgba } from "@forgeron/shaders";
// The CPU side of every step: RGBA bytes for a PNG, or tone paths for an SVG (toSvgPath).
const rgba = toRgba(runCpu(chainOf(builtInPresets()["reveal"]), 320, 200, { time: 1.7 }));API → Options
| Option | Type | Default | Description |
|---|---|---|---|
duration | number | 1.5 | Seconds of sweep. |
hold | number | 1.5 | Seconds settled. |
loop | boolean | false | Restart after the hold. |
front | number[] | [3,2] | Tones worn at the front. |
band | number | 0.06 | Share per tone. |
dither | number | 0.12 | Bayer jitter. |
matrix | 2 | 4 | 8 | 8 | Bayer matrix. |