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

PropTypeDefaultDescription
firstContentReactNodeRequiredInitial content
secondContentReactNodeRequiredRevealed content
gridSizenumber7Number of pixels per row/column
pixelColorstring'#000000'Color of transition pixels
animationStepDurationnumber0.3Duration of transition (seconds)
classNamestring''Additional CSS classes
styleCSSProperties{}Inline styles
aspectRatiostring'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