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.
On this page
ProMosaic steps of 64 down to 1 px with 120 ms holds, beside a slower 240 ms hold.
Installation
Usage
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
| Prop | Type | Notes |
|---|---|---|
src, alt | string | alt is required: the accessible name, announced once the image is in |
progress | number | null | Real job progress, 0 to 1. null means running with no numbers. Leave it out for timer mode |
revealed | boolean | Timer mode: false holds the first frame, true plays once the image loads. Default true |
duration | number | Timer length in ms. Default 120 per step, so 720 for the six default steps |
onRevealed | () => void | Once per image, when the plain image shows |
onStatusChange | (status: "loading" | "ready" | "revealing" | "revealed" | "error") => void | |
aspectRatio, width, height | Set the frame before the image loads, so nothing shifts | |
paper | string | The ground under the effect. Token or CSS color. Default var(--chatcn-bg) |
announcement | string | false | What the live region says once revealed. Default Image ready: <alt> |
errorText, retryLabel | Copy for the error state and its reload button | |
steps | number[] | Block sizes in CSS px, coarse to fine, ending at 1. Default [64, 32, 16, 8, 4, 1] |
maxPixels | number | Default 1.5 MP |
Keyboard
| Key | Action |
|---|---|
Tab | Reaches 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 youraltis always there, and the frame isaria-busyuntil 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: activethe 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.