Dither Compare
Two pictures one over the other with a divider you drag across. The pictures stay exactly as they are, so the comparison is honest; only the seam is dithered, each cell in a narrow band showing one picture or the other at its blue-noise threshold, so the boundary reads as a stipple rather than a hard edge. The handle is a dotted line and a grip of dots. Drag anywhere, click to jump, or use the arrow keys; it nudges itself once when it first comes into view, to say it moves.
Needs: None. Canvas 2D.
Demo photos by Linh Nguyen and Kenneth Thewissen on Unsplash
Customize
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| before | string | required | The picture on the left. |
| after | string | required | The picture on the right. |
| alt | string | required | What the two show, for screen readers. |
| labels | [string, string] | – | Names in the corners. |
| defaultPosition | number | 0.5 | Where the divider starts, 0 to 1. |
| onChange | (position: number) => void | – | Called as the divider moves. |
| aspect | number | 1.5 | Width over height. |
| cell | number | 3 | Size of one dither cell in the seam, in px. |
| seam | number | 28 | How wide the dithered seam is, in px. |
| className | string | – | Class on the comparison. |
| style | CSSProperties | – | Style on the comparison. |