text animations
Text Cursor Proximity
Characters scale, change colour, or transform based on how close the cursor is — any CSS property can be mapped from a resting value to a target value with three falloff curve options for shaping the effect.
Installation
Usage
Anatomy
Good to know
containerRefandstylesare required.stylesmaps each CSS property to afromandtovalue.- Letters closer to the cursor move further toward the
tovalues.radiussets the reach andfalloffthe curve. - It follows the mouse, so there's no effect on touch screens.
- Screen readers read the full text once; the individual letters are hidden from them.
- When the user has turned on reduced motion, the letters do not react to the cursor and keep their
fromstyles.
Props
Examples
Scale
Characters scale up as the cursor approaches. The radius controls how large the influence zone is.
Opacity Reveal
Two lines start nearly invisible and reveal as the cursor sweeps over them. falloff="gaussian" creates a soft spotlight effect.
Scale and Color
Characters simultaneously grow and shift colour near the cursor. falloff="exponential" sharpens the threshold so the effect only activates very close.