Skip to content
Sign in
EffectsHalftone revealMenu

Halftone revealPro

Halftone dots grow from points to their full tone, center out, then the screen crossfades into the photo.

ProDots grow from points to full tone, center out, then give way to the photo, at three screen sizes.

Installation

$ pnpm dlx shadcn@latest add @chatcn-pro/halftone-reveal

Usage

tsx
import { HalftoneReveal } from "@/components/ui/chatcn/pro/halftone-reveal"

<HalftoneReveal src={image.url} alt={image.prompt} cellSize={7} />

Each dot grows as a whole, so the screen reads as dots at every frame, and the growth front travels from the center to the corners. Dots stand for dark on a light paper and for light on a dark one.

Examples

States

Waiting for the image, running at 40%, running with no numbers, held by revealed={false}, revealed, a missing file, a timer and right to left.

ProEvery state of the halftone reveal.

Props

PropTypeNotes
src, altstringalt is required: the accessible name, announced once the image is in
progressnumber | nullReal job progress, 0 to 1. null means running with no numbers. Leave it out for timer mode
revealedbooleanTimer mode: false holds the first frame, true plays once the image loads. Default true
durationnumberTimer length in ms. Default 2000
onRevealed() => voidOnce per image, when the plain image shows
onStatusChange(status: "loading" | "ready" | "revealing" | "revealed" | "error") => void
aspectRatio, width, heightSet the frame before the image loads, so nothing shifts
paperstringThe ground under the effect. Token or CSS color. Default var(--chatcn-bg)
announcementstring | falseWhat the live region says once revealed. Default Image ready: <alt>
errorText, retryLabelCopy for the error state and its reload button
cellSizenumberCSS px between dot centers. Default 6
anglenumberScreen angle in degrees. Default 45
inkstringDots. Default var(--chatcn-fg)
contrastnumberDefault 1.1
maxPixels, rendererAs in Dither reveal

Keyboard

KeyAction
TabReaches the Reload image button in the error state. The reveal itself takes no focus

Accessibility

  • The effect layer is aria-hidden. The real <img> with your alt is always there, and the frame is aria-busy until the reveal ends.
  • A polite live region says Image ready: <alt> once, when the plain image shows. Progress ticks are never announced.
  • Under forced-colors: active the effect hides and the plain image shows with system colors.
  • A broken file shows what happened and a Reload image button that retries the download.

Motion

  • Dots grow over 72% of the run with an out curve, the center leading the corners by 45%; the last 28% crossfades to the photo.
  • Under reduced motion one still frame holds while the job runs, then the image crossfades in over 200 ms. Nothing moves.
  • The timer only runs on screen in a visible tab; offscreen it waits where it was.