AI CSS Animations

Twisting Text Effect

The word is sliced into eight bands that each spin a full turn a moment after the one above, so it twists like a ribbon before settling flat. The bands are clip-path slices of the same text.

Also known as: ribbon twist text, twist text animation css, helix text effect.

HTML

<div class="txt-twisting-text" aria-label="TWIST"><span class="txt-twisting-text-bands" aria-hidden="true"><span style="--i: 0; clip-path: inset(0% 0 86.9% 0)">TWIST</span><span style="--i: 1; clip-path: inset(11.9% 0 74.4% 0)">TWIST</span><span style="--i: 2; clip-path: inset(24.4% 0 61.9% 0)">TWIST</span><span style="--i: 3; clip-path: inset(36.9% 0 49.4% 0)">TWIST</span><span style="--i: 4; clip-path: inset(49.4% 0 36.9% 0)">TWIST</span><span style="--i: 5; clip-path: inset(61.9% 0 24.4% 0)">TWIST</span><span style="--i: 6; clip-path: inset(74.4% 0 11.9% 0)">TWIST</span><span style="--i: 7; clip-path: inset(86.9% 0 0% 0)">TWIST</span></span></div>

CSS

.txt-twisting-text {
  --c: var(--txt-color, #3b82f6);
  font-size: calc(var(--txt-size, 32px) * 1.9);
  font-family: system-ui, sans-serif;
  font-weight: 900;
  line-height: 1.2;
  display: inline-block;
  color: var(--c);
  letter-spacing: 0.02em;}
.txt-twisting-text-bands {
  display: grid;
}
.txt-twisting-text-bands span {
  grid-area: 1 / 1;
  animation: txt-twisting-text-turn 4s infinite backwards;
  animation-delay: calc(var(--i) * 60ms);
}
@keyframes txt-twisting-text-turn {
  0%, 24%   { transform: perspective(8em) rotateY(0deg); color: var(--c); animation-timing-function: cubic-bezier(0.55, 0, 0.45, 1); }
  45%       { transform: perspective(8em) rotateY(180deg); color: color-mix(in srgb, var(--c) 62%, #000); animation-timing-function: cubic-bezier(0.55, 0, 0.45, 1); }
  66%, 100% { transform: perspective(8em) rotateY(360deg); color: var(--c); }
}

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