cnippet/ui
  1. motion
  2. text animations
  3. variable font cursor proximity

text animations

Variable Font Cursor Proximity

Font variation axes respond in real time to cursor distance — characters closest to the cursor reach the target weight, slant, or width while those farther away remain at rest. Three falloff curves give precise control over the effect radius.

Installation

Usage

Variable font required. This component animates font-variation-settings directly. Your project must load a variable font that supports the axes you specify (e.g. Inter Variable for wght and slnt).

Anatomy

Good to know

  • It needs a variable font that supports the axes you animate. With a normal font nothing changes.
  • containerRef is required. It's the area where the cursor position is tracked.
  • Letters closer to the cursor move toward the to settings. radius sets the reach and falloff the 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 fromFontVariationSettings.

Props

Examples

Hero Headline

Single line grows from ultra-light to black as the cursor approaches each character. radius={80} gives a wide influence zone.

Dual Lines with Inverted Axes

Two lines with mirrored settings — the first goes thin-to-bold while the second goes bold-to-thin. falloff="gaussian" creates a smooth bell-curve effect.

Four nav items respond to proximity with falloff="exponential" for a sharper, more focused effect near the cursor.