Skip to content
PixiKit

Magnetic Pull

Wraps anything so it is pulled toward the pointer on a spring when the pointer comes close, and springs back when it leaves.

pixikit.com/docs/effects/magnetic-pull

Customize

Padding100px
Magnet strength2.0
Exclusive
Axis
Tilt6°
Scale1.00
Stiffness170
Damping16
Mass1.0
Disabled

Props

16
NameTypeDefaultDescription
childrenReactNodeNoneWhat gets pulled toward the pointer.
paddingnumber100Distance in pixels around the element where the pointer starts to pull it.
magnetStrengthnumber2How far it follows the pointer: the offset is divided by this, so 1 follows the pointer and higher values move less.
exclusivebooleantrueWith several magnets in range, only the nearest exclusive one is pulled; turn it off to let a group lean together.
axis"both" | "x" | "y""both"Limits the movement to one axis.
maxOffsetnumberNoneCaps how far it can move from its resting place, in pixels.
tiltnumber0Maximum 3D tilt toward the pointer, in degrees.
scalenumber1Scale of the element while the pointer pulls it.
stiffnessnumber170Spring stiffness: higher reacts faster.
dampingnumber16Spring damping: lower lets it overshoot and wobble back.
massnumber1Spring mass: higher feels heavier.
disabledbooleanfalseTurns the pull off and lets the element spring back to rest.
onActiveChange(active: boolean) => voidNoneCalled when the pointer enters or leaves the magnetic area.
wrapperClassNamestringNoneClass for the outer wrapper, which stays in place.
innerClassNamestringNoneClass for the inner element that moves.
styleCSSPropertiesNone

More interaction effects in Pro

View all

Related