Skip to content
PixiKit

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
NameTypeDefaultDescription
firstContentReactNodeNoneShown at rest: any node, or an image address.
secondContentReactNodeNoneRevealed by the transition: any node, or an image address.
gridSizenumber10Pixels across the card; rows follow so every pixel stays square.
pixelColorstring"#ffffff"The pixels' colour; any CSS colour, variables included.
mosaicnumber0Gives each pixel a slightly different tone, 0 to 1.
animationStepDurationnumber0.4Seconds 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.
randomnessnumber0.3Breaks 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.
gapnumber0Space between pixels, in pixels.
fpsnumber0Caps redraws per second for a choppy retro feel; 0 redraws every frame.
trigger"hover" | "click""hover"What starts the transition.
activebooleanNoneSets which content shows from outside; pair it with onActiveChange.
oncebooleanfalseKeeps the second content once it has been revealed.
onActiveChange(active: boolean) => voidNoneCalled when hover, focus or a click asks for the other content.
aspectRatiostring"100%"The card's height: a percent works like padding-top ("125%"), anything else is a CSS ratio ("4 / 5").
classNamestringNone
styleCSSPropertiesNone

More interaction effects in Pro

View all

Related