GenerativeImage

Image reveal effects that mimic AI generation — particles drift freely then assemble into the image from top to bottom, resolving into the original.

Effects

Blur uses CSS animations. Pixel uses a Canvas 2D particle engine with a loading → assembly → reveal flow.

<GenerativeImage
  src="/ai-output.jpg"
  alt="AI generated"
  width={400}
  height={300}
  effect="blur"
  speed="slow"
/>

Loading Duration

How long particles drift before assembly begins.

createPixelEffect({ loadingDuration: 500 })

Assembly Duration

How long the top-to-bottom assembly wave takes.

createPixelEffect({ assemblyDuration: 1000 })

Pixel Density

Lower gap = more particles = finer detail.

createPixelEffect({ gap: 2, particleSize: 2 })

Ease Speed

How quickly particles settle into position. Higher = snappier.

createPixelEffect({ easeSpeed: 0.03 })

Glow

Particles emit a soft colored light matching their pixel color. Creates a neon/firefly feel.

createPixelEffect({ glow: true, glowRadius: 6 })

createPixelEffect Options

PropTypeDefaultDescription
containerHTMLElement—DOM element for canvas (required)
imagestring—Image URL (required)
gapnumber4Pixel sampling gap
particleSizenumber4Particle size (px)
loadingDurationnumber1500Drift phase duration (ms)
assemblyDurationnumber2000Assembly wave duration (ms)
easeSpeednumber0.06Particle easing factor (0–1)
overflownumber0.15How far particles can exceed bounds (fraction)
glowbooleanfalseParticles emit colored light matching their pixel
glowRadiusnumber6Glow blur radius (px)
maxCanvasWidthnumber320Caps particle count by downscaling the source image before sampling
onComplete() => void—Called when real image is visible

Instance Methods

PropTypeDefaultDescription
start()() => void—Begin the animation
stop()() => void—Pause the animation
replay()() => void—Reset and replay from loading phase
destroy()() => void—Clean up canvas and DOM