Installation
Usage
Examples
Basic Usage
Custom Grid Size
Without Grayscale Animation
Custom Animation Timing
Custom Grid Dimensions
Animate Every Time (Not Once)
Props
The URL of the image to display.
Predefined grid size for the pixelated effect. Options:
"6x4"- 6 columns, 4 rows (default)"8x8"- 8 columns, 8 rows"8x3"- 8 columns, 3 rows"4x6"- 4 columns, 6 rows"3x8"- 3 columns, 8 rows
Custom grid dimensions. Must have rows and cols between 1 and 16. Overrides the
grid prop if provided.Whether to animate from grayscale to color. When true, the image starts in grayscale and transitions to full color.
Duration in milliseconds for each pixel piece to fade in.
Maximum random delay in milliseconds before a pixel piece starts fading in.
Delay in milliseconds before the grayscale-to-color transition starts (only applies if
grayscaleAnimation is true).If true, the animation only plays once when the element enters the viewport. If false, the animation resets and replays each time the element enters/exits the viewport.
Features
- Pixelated reveal animation with randomized delays
- Optional grayscale to color transition
- Multiple predefined grid sizes
- Custom grid dimensions support
- Intersection observer triggers animation when visible
- Configurable animation timing
- Rounded corners on the image
- Responsive sizing
How It Works
- The image is divided into a grid of pieces using CSS clip-path
- Each piece has a random delay before fading in
- When the component enters the viewport, pieces fade in progressively
- If grayscale animation is enabled, the image transitions from grayscale to color after all pieces are visible
- If
onceis false, the animation resets when leaving and re-entering the viewport
Grid Constraints
- Minimum grid size: 1x1
- Maximum grid size: 16x16
- Custom grids must have integer values for rows and cols
Dependencies
- motion-sv (for
useInView) - runed (for
watchreactive utility)
Accessibility
- Each pixel piece includes an alt attribute with a descriptive label
- Images are marked as non-draggable for better UX