AI CSS Animations

Dotted to Solid Outline Text

Letters start as a dotted tracing outline, the dots stretch into dashes and join into a solid line, then a light fill settles in. The dots are zero-length dashes with round caps.

Also known as: dotted outline text css, connect the dots text, dashed to solid stroke animation.

TRACE

HTML

<svg class="txt-dotted-to-solid-outline" viewBox="0 0 420 110" role="img" aria-label="TRACE"><text x="210" y="86" text-anchor="middle" font-size="92">TRACE</text></svg>

CSS

.txt-dotted-to-solid-outline {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  width: 9.5em;
  height: auto;
  overflow: visible;}
.txt-dotted-to-solid-outline text {
  font-family: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  font-weight: 900;
  fill: var(--c);
  fill-opacity: 0;
  stroke: var(--c);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  /* a zero-length dash with a round cap is a dot */
  stroke-dasharray: 0 9;
  animation:
    txt-dotted-to-solid-outline-join 1.4s cubic-bezier(0.65, 0, 0.35, 1) 0.4s forwards,
    txt-dotted-to-solid-outline-fill 0.6s ease-out 1.6s forwards;
}
@keyframes txt-dotted-to-solid-outline-join {
  to { stroke-dasharray: 9 0; }
}
@keyframes txt-dotted-to-solid-outline-fill {
  to { fill-opacity: 0.2; }
}

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