Back to library
INTERACTION_048

Character Wave.

A slow sine wave travels through the characters of a word. All characters on the baseline before the trigger; translating each character up 6px and back with a phase offset once the word is in view, looping every 2.4 seconds.

CATEGORY
Letters
COMPLEXITY
Easy
TECH
CSS
PLATFORM
Both
PERFORMANCE
Light
LIVE PLAYGROUND
VAULT
CSS / CSS
/* Character Wave — A slow sine wave travels through the characters of a word. */
.character-wave {
  --dur: 2.4s;
  --ease: ease-in-out;
  --stagger: 60ms;
  will-change: transform, opacity;
}

.character-wave > * {
  opacity: 0;
  transform: translateY(14px);
  animation: character-wave-in var(--dur) var(--ease) forwards;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}

/* all characters on the baseline -> translating each character up 6px and back with a phase offset */
@keyframes character-wave-in {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .character-wave > * {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
React / TSX
import { useEffect, useRef } from "react";

/** Character Wave — trigger: the word is in view, looping every 2.4 seconds */
export function CharacterWave({ children }: { children: React.ReactNode }) {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current;
    if (!el) return;
    if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
      el.dataset["state"] = "in";
      return;
    }
    const io = new IntersectionObserver(
      ([entry]) => {
        if (entry?.isIntersecting) {
          el.dataset["state"] = "in";
          io.unobserve(el);
        }
      },
      { threshold: 0.2 },
    );
    io.observe(el);
    return () => io.disconnect();
  }, []);

  return (
    <div ref={ref} className="character-wave" data-state="out">
      {children}
    </div>
  );
}

IF YOU LIKE THIS, STEAL THESE TOO.

VAULT
INTERACTION_059CSS

Character Stretch

Characters stretch vertically on entry then relax.

Letters / LightView
VAULT
INTERACTION_047CSS

Letter By Letter Fade

Characters fade in one by one to draw the eye across the word.

Letters / LightView
VAULT
INTERACTION_049CSS

Elastic Letters

Characters overshoot their final position then settle.

Letters / LightView
VAULT
INTERACTION_052CSS

Letter Blur

Characters sharpen from a heavy blur into crisp type.

Letters / MediumView