AI CSS Animations

Hinge Fall Rotating Words

Each word drops into the headline, then comes loose at one end: it swings on its first letter, wobbles and falls away before the next one lands. A damped swing in keyframes on a top-left pivot.

Also known as: hinge text animation, falling word swap, broken sign text rotator.

Drop the jargon excuses drama

HTML

<div class="txt-hinge-rotating-words">Drop the
  <span class="txt-hinge-rotating-words-words">
    <span style="--i: 0">jargon</span>
    <span style="--i: 1">excuses</span>
    <span style="--i: 2">drama</span>
  </span>
</div>

CSS

.txt-hinge-rotating-words {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  display: flex;
  align-items: baseline;
  gap: 0.28em;
  white-space: nowrap;}
.txt-hinge-rotating-words-words {
  display: inline-grid;
  color: var(--c);
}
.txt-hinge-rotating-words-words span {
  grid-area: 1 / 1;
  justify-self: start;
  /* the pivot: top of the first letter */
  transform-origin: 0.1em 25%;
  /* 3 words x 2.8s = 8.4s */
  animation: txt-hinge-rotating-words-hinge 8.4s infinite;
  animation-delay: calc(var(--i) * 2.8s - 9s);
}
.txt-hinge-rotating-words-words span:not(:first-child) {
  opacity: 0;
}
@keyframes txt-hinge-rotating-words-hinge {
  0% {
    opacity: 0; transform: translateY(-0.5em) rotate(0);
    animation-timing-function: cubic-bezier(0.3, 1.5, 0.5, 1);
  }
  5.36%  { opacity: 1; transform: translateY(0) rotate(0); }
  21.43% {
    opacity: 1; transform: translateY(0) rotate(0);
    animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.45);
  }
  25%  { transform: translateY(0) rotate(38deg); animation-timing-function: ease-in-out; }
  26.79% { transform: translateY(0) rotate(24deg); animation-timing-function: ease-in-out; }
  28.33% { transform: translateY(0) rotate(34deg); animation-timing-function: ease-in-out; }
  29.52% {
    opacity: 1; transform: translateY(0) rotate(29deg);
    animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45);
  }
  33.33% { opacity: 0; transform: translateY(1.2em) rotate(33deg); }
  100%   { opacity: 0; transform: translateY(-0.5em) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .txt-hinge-rotating-words, .txt-hinge-rotating-words *, .txt-hinge-rotating-words::before, .txt-hinge-rotating-words::after, .txt-hinge-rotating-words *::before, .txt-hinge-rotating-words *::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