Skip to content
Sign in
EffectsPixelate revealMenu

Pixelate revealPro

Mosaic resolution steps of 64, 32, 16, 8, 4 and 1 px with 120 ms holds. Discrete steps read as intentional, not blurry.

ProMosaic steps of 64 down to 1 px with 120 ms holds, beside a slower 240 ms hold.

Installation

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

Usage

tsx
import { PixelateReveal } from "@/components/ui/chatcn/pro/pixelate-reveal"

<PixelateReveal src={image.url} alt={image.prompt} />

Canvas 2D with smoothing off. Each step divides the frame into whole blocks and samples exactly the object-fit: cover crop, so the last step lines up with the real image pixel for pixel and the swap is invisible. The default duration is 120 ms per step; pass duration for slower holds.

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 pixelate 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 120 per step, so 720 for the six default steps
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
stepsnumber[]Block sizes in CSS px, coarse to fine, ending at 1. Default [64, 32, 16, 8, 4, 1]
maxPixelsnumberDefault 1.5 MP

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

  • Six hard cuts, one per step. Nothing blends, scales or moves.
  • 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.