Text Animations

Anaglyph

Stereoscopic channel-split type. The real headline stays put, selectable, one announcement to a screen reader, while two aria-hidden copies in opposing ink colors slide against each other under the pointer, and the blend mode resolves their overlap back toward white, so the depth lives entirely in the fringes, exactly as it does on a printed anaglyph. The channels chase the cursor through an exponential lerp written straight to transform, and once the pointer goes quiet a slow bounded-phase sway takes the target over so the split keeps breathing on an idle pane.

Install

# Anaglyph needs no npm packages

Then copy 2 files into your project:

  • components/registry/anaglyph/anaglyph.tsx
  • hooks/use-animation-loop.ts

Props

PropTypeDefaultDescription
maxShiftnumber14Peak channel separation at the pane edge.
responsenumber1How much pointer travel converts into separation.
lagnumber0.18Chase time constant — the channels arrive after the cursor.
swaynumber0.5Idle drift amplitude once the pointer has gone quiet.
layers"two" | "three""three"Two channels split on one axis; three adds a perpendicular half-shift ghost.
blend"screen" | "lighten" | "difference""screen"How the channels composite where they overlap.
channelAstring (hex)"#c4b5fd"First offset layer.
channelBstring (hex)"#67e8f9"Opposing offset layer.

What It Demonstrates

Hover effect
Visual change when the cursor moves over an element.
Translate
Move an element along the X or Y axis.
Interpolation / Tween
Generating all the in-between frames between a start and end value, so motion is continuous.
Idle animation
Subtle motion that plays while an element is just sitting there, waiting to be interacted with.

Related Components

Appears In