AI CSS Animations

Kinetic Typography Text

Three words arrive one after another from different directions, the camera drifts, then the whole block spins away and it starts over. Kinetic typography built from four timed keyframe tracks.

Also known as: kinetic typography css, kinetic text animation, motion typography.

HTML

<div class="txt-kinetic-typography" aria-label="Make it move"><div class="txt-kinetic-typography-block" aria-hidden="true"><span class="txt-kinetic-typography-make">MAKE</span><span class="txt-kinetic-typography-it">IT</span><span class="txt-kinetic-typography-move">MOVE</span></div></div>

CSS

.txt-kinetic-typography {
  --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: inline-block;
  font-weight: 900;
  color: var(--c);}
.txt-kinetic-typography-block {
  display: grid;
  grid-template-areas: "make it" "move move";
  align-items: end;
  line-height: 1;
  animation: txt-kinetic-typography-camera 5.2s infinite;
}
.txt-kinetic-typography-make {
  grid-area: make;
  justify-self: start;
  display: block;
  animation: txt-kinetic-typography-make 5.2s infinite;
}
.txt-kinetic-typography-it {
  grid-area: it;
  justify-self: end;
  color: color-mix(in srgb, var(--c) 55%, transparent);
  display: block;
  animation: txt-kinetic-typography-it 5.2s infinite;
}
.txt-kinetic-typography-move {
  grid-area: move;
  font-size: 2.1em;
  letter-spacing: -0.02em;
  display: block;
  animation: txt-kinetic-typography-move 5.2s infinite;
}
@keyframes txt-kinetic-typography-make {
  0%       { opacity: 0; transform: translateX(-1.4em); animation-timing-function: cubic-bezier(0.2, 0.9, 0.3, 1.25); }
  8%, 100% { opacity: 1; transform: none; }
}
@keyframes txt-kinetic-typography-it {
  0%, 6%    { opacity: 0; transform: translateY(-1.1em); animation-timing-function: cubic-bezier(0.3, 1.5, 0.5, 1); }
  13%, 100% { opacity: 1; transform: none; }
}
@keyframes txt-kinetic-typography-move {
  0%, 12%   { opacity: 0; transform: scale(2.4); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  18%       { opacity: 1; transform: scale(0.94); animation-timing-function: ease-out; }
  21%, 100% { opacity: 1; transform: none; }
}
/* impact jolt, slow camera drift, then a quarter-turn spin out */
@keyframes txt-kinetic-typography-camera {
  0%, 18% { opacity: 1; transform: none; }
  19.5%   { transform: translateY(0.08em); }
  21%     { transform: translateY(-0.03em); }
  23%     { transform: none; animation-timing-function: cubic-bezier(0.45, 0, 0.55, 1); }
  76%     { opacity: 1; transform: rotate(-4deg) scale(1.08); animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.5); }
  88%, 100% { opacity: 0; transform: rotate(-90deg) scale(0.2); }
}

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