AI CSS Animations

Pop Out 3D Text

The word lifts off the page toward you with a slight tilt while its shadow stays behind, spreading and softening, then settles back with a small bounce. translateZ in a perspective box.

Also known as: text lift off page, 3d pop out text css, floating text shadow.

POP OUT

HTML

<div class="txt-pop-out-3d-text"><span class="txt-pop-out-3d-text-shadow" aria-hidden="true">POP OUT</span><span class="txt-pop-out-3d-text-word">POP OUT</span></div>

CSS

.txt-pop-out-3d-text {
  --c: var(--txt-color, #3b82f6);
  font-size: calc(var(--txt-size, 32px) * 1.6);
  font-family: system-ui, sans-serif;
  font-weight: 900;
  line-height: 1.2;
  display: inline-grid;
  perspective: 8em;
  letter-spacing: 0.02em;}
.txt-pop-out-3d-text-shadow,
.txt-pop-out-3d-text-word {
  grid-area: 1 / 1;
  animation: 3.4s infinite;
}
.txt-pop-out-3d-text-word {
  color: var(--c);
  animation-name: txt-pop-out-3d-text-lift;
}
/* the shadow stays on the page and only spreads */
.txt-pop-out-3d-text-shadow {
  color: color-mix(in srgb, var(--c) 40%, transparent);
  animation-name: txt-pop-out-3d-text-shadow;
}
@keyframes txt-pop-out-3d-text-lift {
  0%, 14%   { transform: none; animation-timing-function: cubic-bezier(0.34, 1.5, 0.64, 1); }
  38%, 66%  { transform: translateZ(1.3em) translateY(-0.12em) rotateX(10deg); animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.5); }
  80%       { transform: none; animation-timing-function: ease-out; }
  86%       { transform: translateZ(0.12em); animation-timing-function: ease-in; }
  92%, 100% { transform: none; }
}
@keyframes txt-pop-out-3d-text-shadow {
  0%, 14%   { opacity: 0; filter: blur(0); transform: none; animation-timing-function: cubic-bezier(0.34, 1.2, 0.64, 1); }
  38%, 66%  { opacity: 1; filter: blur(0.06em); transform: translate(0.1em, 0.22em); animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.5); }
  80%, 100% { opacity: 0; filter: blur(0); transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .txt-pop-out-3d-text, .txt-pop-out-3d-text *, .txt-pop-out-3d-text::before, .txt-pop-out-3d-text::after, .txt-pop-out-3d-text *::before, .txt-pop-out-3d-text *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --txt-color on the element or a parent. Currently previewing #3b82f6.
  • Font size: set --txt-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 40px.
  • Speed: change the duration on the transition or animation shorthand. Staggered delays are relative, so they keep their rhythm.
  • Reduced motion: the rule at the end of the CSS turns the motion off for people who asked their OS for less of it. Keep it.

Similar text animations