Pixel Image

PRO

Canvas-based pixelation effect for images: reveal from pixelated to crisp on scroll or hover, or a live pointer-driven distortion. SSR-safe with an automatic <img> fallback.

Pro Features

Unlock advanced capabilities with the Pro version

Canvas Pixelation

Crisp pixel blocks rendered at the image's native resolution.

In-View Reveal

Single-shot IntersectionObserver resolves pixels to crisp on scroll.

Pointer Distortion

A pixelated patch that follows the cursor over a crisp base.

SSR-Safe Fallback

A plain <img> is always in the DOM — no layout shift, no blank frame.

Graceful Degradation

Falls back silently on load errors or cross-origin canvas taint.

rAF Performance

Frame-throttled drawing and reduced-motion awareness built in.

Installation

Install via CLI

npx @moontra/moonui-cli add pixel-image

Usage

Pro Required
Random scenic photo

Examples

Reveal on scroll

PRO

In the default 'in-view' mode the image starts pixelated and resolves to crisp once, when it scrolls into view — that entrance fires a single time, so use the Replay button to watch it again. Under prefers-reduced-motion the canvas never runs and the crisp image is shown immediately.

Pro Required
Scenic photo revealed from pixels

Hover to reveal

PRO

With trigger="hover" the image stays pixelated until the pointer enters, then re-pixelates on leave.

Pro Required
Scenic photo that reveals on hover

Pointer distortion

PRO

The 'distortion' mode paints a crisp base and pixelates a circular patch that follows the pointer. This mode ignores the trigger prop.

Pro Required
Scenic photo with a pointer-driven pixel patch

Pixel size comparison

PRO

With mode="static" the image stays permanently pixelated (no reveal, no pointer), so the pixelSize difference is clearly visible side by side — larger values give a chunkier, more retro look.

Pro Required
Photo with fine pixel blocks

pixelSize=8

Photo with chunky pixel blocks

pixelSize=28

CORS modes

PRO

crossOrigin also accepts '' (an alias for 'anonymous') and 'use-credentials' for hosts that require a credentialed CORS request. Same-origin images — like the local one on the right — skip the CORS check entirely, so crossOrigin has no effect on them.

Pro Required
Cross-origin photo loaded with the CORS anonymous alias

crossOrigin=""

Same-origin photo loaded with a credentialed CORS mode

crossOrigin="use-credentials"