Back to library
INTERACTION_049

Elastic Letters.

Characters overshoot their final position then settle. Scaled to 0.6 with 0 opacity before the trigger; scaling past 1.08 before settling at 1 once entry into view.

CATEGORY
Letters
COMPLEXITY
Easy
TECH
CSS
PLATFORM
Both
PERFORMANCE
Light
LIVE PLAYGROUND
VAULT
CSS / CSS
/* Elastic Letters — Characters overshoot their final position then settle. */
.elastic-letters {
  --dur: 620ms;
  --ease: cubic-bezier(0.34, 1.56, 0.64, 1);
  --stagger: 40ms;
  will-change: transform, opacity;
}

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

/* scaled to 0.6 with 0 opacity -> scaling past 1.08 before settling at 1 */
@keyframes elastic-letters-in {
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

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

/** Elastic Letters — trigger: entry into view */
export function ElasticLetters({ 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="elastic-letters" data-state="out">
      {children}
    </div>
  );
}

IF YOU LIKE THIS, STEAL THESE TOO.

VAULT
INTERACTION_047CSS

Letter By Letter Fade

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

Letters / LightView
VAULT
INTERACTION_048CSS

Character Wave

A slow sine wave travels through the characters of a word.

Letters / LightView
VAULT
INTERACTION_052CSS

Letter Blur

Characters sharpen from a heavy blur into crisp type.

Letters / MediumView
VAULT
INTERACTION_057CSS

Hover Letter Displacement

The hovered character pushes its neighbours aside.

Letters / LightView