Pixel Swap
Swaps two pieces of content behind a wave of pixels: they cover the card in a random, dithered, rippling or wiping order, the content changes underneath, and they clear again.
pixikit.com/docs/effects/pixel-swap
Customize
Grid size10
Pixel color
Mosaic0.00
Animation step duration0.40s
Pattern
Randomness0.30
Pixel animation
Pixel shape
Gap0px
Fps0
Trigger
Once
Props
19| Name | Type | Default | Description |
|---|---|---|---|
firstContent | ReactNode | None | Shown at rest: any node, or an image address. |
secondContent | ReactNode | None | Revealed by the transition: any node, or an image address. |
gridSize | number | 10 | Pixels across the card; rows follow so every pixel stays square. |
pixelColor | string | "#ffffff" | The pixels' colour; any CSS colour, variables included. |
mosaic | number | 0 | Gives each pixel a slightly different tone, 0 to 1. |
animationStepDuration | number | 0.4 | Seconds the pixels take to cover the card, and again to clear it. |
pattern | "random" | "dither" | "ripple" | "wipe" | "random" | The order pixels appear in; ripple spreads from the pointer, wipe sweeps in from the edge it crossed. |
randomness | number | 0.3 | Breaks up the ripple and wipe fronts, 0 to 1. |
pixelAnimation | "pop" | "grow" | "fade" | "pop" | How each pixel appears and disappears. |
pixelShape | "square" | "rounded" | "circle" | "square" | The pixels' shape while the transition runs; they merge into a solid cover at the midpoint. |
gap | number | 0 | Space between pixels, in pixels. |
fps | number | 0 | Caps redraws per second for a choppy retro feel; 0 redraws every frame. |
trigger | "hover" | "click" | "hover" | What starts the transition. |
active | boolean | None | Sets which content shows from outside; pair it with onActiveChange. |
once | boolean | false | Keeps the second content once it has been revealed. |
onActiveChange | (active: boolean) => void | None | Called when hover, focus or a click asks for the other content. |
aspectRatio | string | "100%" | The card's height: a percent works like padding-top ("125%"), anything else is a CSS ratio ("4 / 5"). |
className | string | None | |
style | CSSProperties | None |