AI CSS Animations

Flip In

The line swings down into place from a 90-degree tilt, with perspective. Set the transform origin to the top so it hinges like a sign being lowered.

Also known as: 3D text flip, rotate in text, flip down text.

Now showing

HTML

<div class="txt-flip-in">Now showing</div>

CSS

.txt-flip-in {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  color: var(--c);
  opacity: 0;
  transform-origin: 50% 0;
  animation: txt-flip-in-drop 0.8s cubic-bezier(0.2, 0.8, 0.3, 1.2) forwards;}
@keyframes txt-flip-in-drop {
  from { opacity: 0; transform: perspective(20em) rotateX(-90deg); }
  to   { opacity: 1; transform: perspective(20em) rotateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  .txt-flip-in, .txt-flip-in *, .txt-flip-in::before, .txt-flip-in::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