Pixel Transition
A pixelated reveal effect transitioning between two content states
Configuring your account...
Please wait while we prepare everything for you
Usage
import PixelTransition from '@/components/bynanaui/pixel-transition';
export default function Demo() {
return (
<PixelTransition
firstContent={
<img
src="https://picsum.photos/400/400?grayscale"
alt="First state"
style={{ width: '100%', height: '100%', objectFit: 'cover' }}
/>
}
secondContent={
<div style={{
width: '100%',
height: '100%',
display: 'grid',
placeItems: 'center',
backgroundColor: '#000'
}}>
<p style={{ fontWeight: 900, fontSize: '3rem', color: '#fff' }}>
Revealed!
</p>
</div>
}
gridSize={12}
pixelColor="#000000"
animationStepDuration={0.4}
/>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
firstContent | ReactNode | Required | Initial content |
secondContent | ReactNode | Required | Revealed content |
gridSize | number | 7 | Number of pixels per row/column |
pixelColor | string | '#000000' | Color of transition pixels |
animationStepDuration | number | 0.3 | Duration of transition (seconds) |
className | string | '' | Additional CSS classes |
style | CSSProperties | {} | Inline styles |
aspectRatio | string | '100%' | Padding-top for aspect ratio |
Features
- Pixelated Reveal: Random pixel-by-pixel transition
- GSAP Powered: Smooth, staggered animations
- Hover/Click Trigger: Activate on hover (desktop) or click (mobile)
- Reversible: Transition back to first content
- Customizable Grid: Control pixel size with gridSize
- Black & White Support: Works with any color scheme