- Docs
- Components
- Cursor Effects
- Pixel Magnet
Pixel Magnet
A cursor trail that magnetises the pixels it passes through
Customize
Props
26| Name | Type | Default | Description |
|---|---|---|---|
width | string | number | "100%" | Container width. |
height | string | number | "100%" | Container height. |
className | string | undefined | Additional CSS classes. |
children | ReactNode | undefined | Content rendered above the effect. |
count | number | 25 | Number of squares in the swarm. |
seed | number | 1 | Starting seed. Change it for a different arrangement. |
resolution | number | 100 | Grid the squares snap to. Higher values give smaller squares. |
flow | "contract" | "expand" | "contract" | Whether squares fall inward or fly outward. |
speed | number | 1 | How fast the swarm cycles. |
spread | number | 1 | Radius of the swarm relative to half the container height. |
sizeSpread | number | 1.5 | Extra size added to the largest squares. |
falloff | number | 1.05 | Radius at which the swarm fades out. |
falloffCurve | number | 0.5 | Softness of that fade. |
color | string | "#16a34a" | Colour of the slowest squares. |
hotColor | string | "#bbf7d0" | Colour of the fastest squares. |
backgroundColor | string | "#0a0a0a" | Background fill colour. Accepts "transparent". |
blendMode | "normal" | "additive" | "normal" | How squares combine where they overlap. |
opacity | number | 1 | Master alpha, from 0 to 1. |
cursorInteraction | boolean | true | Let the swarm follow the pointer. |
follow | number | 10.5 | How quickly the swarm catches up with the pointer. |
velocityActivation | boolean | true | Drive the swarm with pointer speed. |
velocityScale | number | 1.6 | Pointer speed needed to reach full strength. |
idleStrength | number | 0 | Strength the swarm holds while the pointer rests. |
decay | number | 1.2 | How quickly the swarm fades once the pointer stops. Lower values linger. |
dpr | number | 2 | Upper bound on device pixel ratio. |
paused | boolean | false | Hold the animation still. |
widthstring | numberContainer width.
"100%"heightstring | numberContainer height.
"100%"classNamestringAdditional CSS classes.
undefinedchildrenReactNodeContent rendered above the effect.
undefinedcountnumberNumber of squares in the swarm.
25seednumberStarting seed. Change it for a different arrangement.
1resolutionnumberGrid the squares snap to. Higher values give smaller squares.
100flow"contract" | "expand"Whether squares fall inward or fly outward.
"contract"speednumberHow fast the swarm cycles.
1spreadnumberRadius of the swarm relative to half the container height.
1sizeSpreadnumberExtra size added to the largest squares.
1.5falloffnumberRadius at which the swarm fades out.
1.05falloffCurvenumberSoftness of that fade.
0.5colorstringColour of the slowest squares.
"#16a34a"hotColorstringColour of the fastest squares.
"#bbf7d0"backgroundColorstringBackground fill colour. Accepts "transparent".
"#0a0a0a"blendMode"normal" | "additive"How squares combine where they overlap.
"normal"opacitynumberMaster alpha, from 0 to 1.
1cursorInteractionbooleanLet the swarm follow the pointer.
truefollownumberHow quickly the swarm catches up with the pointer.
10.5velocityActivationbooleanDrive the swarm with pointer speed.
truevelocityScalenumberPointer speed needed to reach full strength.
1.6idleStrengthnumberStrength the swarm holds while the pointer rests.
0decaynumberHow quickly the swarm fades once the pointer stops. Lower values linger.
1.2dprnumberUpper bound on device pixel ratio.
2pausedbooleanHold the animation still.
false