Block 273 of 297
Dither Hero
A retro two-color ordered-dither hero whose light source follows the pointer. Bold for arts and campus pages.
- Puck key
- DitherHeroBlock
- Export
- ditherHeroBlock
- React component
- <DitherHero />
- Files
- components/puck/dither-hero-block.tsx
- components/puck/dither-hero.client.tsx
- Dependencies
- vgpu
- License
- MIT
About this block
When to use it, how to write for it, and what to change in the code.
What it's for
A tall hero rendered as a two-color, retro dithered light field, with the light source following the mouse. The copy sits on a solid panel in the shadow color at the lower left, so it reads cleanly over the pattern. On touch devices the light wanders slowly by itself, and without WebGPU a CSS halftone glow stands in.
- Arts, design school or gallery exhibition pages
- Tech, maker or game-related event landing pages
- A bold home page opener for a youth or creative program
Writing the content
- Shadow color is also the text panel, so keep it dark; the copy is white.
- Light color doubles as the primary button fill, so pick one that stands out against the shadow color.
- Pixel size changes the character: Fine looks like a print, Chunky like an 8-bit screen.
- Short, punchy headings suit the condensed type and tight leading.
Accessibility
- Copy sits on an opaque panel, so its contrast is set by your two colors rather than by the moving pattern.
- The canvas is aria-hidden. Reduced-motion visitors get one still frame with no pointer tracking, and the loop stops when off screen.
- Heading level is selectable from H1 to H4, and both links have a white focus outline and 44px minimum height.
Customizing the code
- Needs vgpu and dither-hero.client.tsx. The PIXEL map (2, 4, 7) sets dither cell sizes, and bayer8() can be swapped for bayer4() for a coarser pattern.
- The rest position for the light is set by rest in the shader and the starting aim values; move them to relight a different corner.
Editor fields
What content editors see in the P1 sidebar when they select this block.
- Eyebrowtext
- Headingtextarea
- Heading levelselect
- Bodytextarea
- Primary button texttext
- Primary button linktext
- Secondary link texttext
- Secondary linktext
- Shadow colortext
- Light colortext
- Pixel sizeradio