Image Compare
A hardware-accelerated image comparison slider featuring 8x8 Bayer ordered dithering, customizable multi-tone palettes, seam dissolving, and interactive wobbling spring physics.
Live preview
Interact with the effect here. Drag, hover, and use its controls.
Variation Tweaking
Adjust the options and see the preview update live.
Installation
Install automatically via CLI or manually integrate dependencies and code.
Usage
Import the component and configure visual variants, sizes, and operational states.
import { ImageCompare } from '@/components/ui/image-compare' {/* Rich 4-tone ordered dither (default) */}<ImageCompare /> {/* Hard 1-bit, Game Boy Camera energy */}<ImageCompare palette={['#09090b', '#fafafa']} pixelSize={4} sharpen={0.9} /> {/* Warm duotone-ish ramp */}<ImageCompare palette={['#120b08', '#5a2e1d', '#c9803e', '#fff1d6']} /> {/* Hard cut, no dissolve */}<ImageCompare blendWidth={0} />Composition
Compose with icons, form triggers, and layout containers.
<div className="aspect-[4/3] w-full max-w-2xl overflow-hidden rounded-3xl border border-border"> <ImageCompare beforeSrc="/cj1.jpg" afterSrc="/cj1.jpg" beforeLabel="Bayer Dither" afterLabel="Original" pixelSize={3} wobble wobbliness={1} /></div>API Reference
Property matrix, types, defaults, and usage descriptions.
Data Attributes
State-reflecting DOM attributes for custom selector styling.
This component does not expose custom data attributes. Standard HTML data attributes are forwarded to its interactive element.
How It Works
A WebGL fragment shader quantizes incoming pixels against an 8x8 Bayer threshold matrix mapped into a custom palette texture. Dragging or sweeping the divider calculates velocity vectors to drive a damped spring simulation, bending the divider dynamically in real-time.
Accessibility
The slider container exposes an ARIA slider role with full keyboard support (Arrow keys, Home, End), screen reader position announcements, and graceful fallback for systems with reduced motion.
Limitations
Features
Meet the team behind the interaction
Crafted for modern web applications and AI agent workflows.
