AI CSS Animations

Staggered Letter Shine Text

A glint runs through each letter in turn and lifts it a hair, so the light seems to skip along the word. Every span has its own clipped gradient, delayed by its index.

Also known as: letter by letter shine, per letter glint css, sequential shine text.

Superstar

HTML

<div class="txt-staggered-shine-text" aria-label="Superstar"><span style="--i: 0">S</span><span style="--i: 1">u</span><span style="--i: 2">p</span><span style="--i: 3">e</span><span style="--i: 4">r</span><span style="--i: 5">s</span><span style="--i: 6">t</span><span style="--i: 7">a</span><span style="--i: 8">r</span></div>

CSS

.txt-staggered-shine-text {
  --c: var(--txt-color, #3b82f6);
  font-size: var(--txt-size, 32px);
  font-family: system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  font-weight: 800;}
.txt-staggered-shine-text span {
  display: inline-block;
  background: linear-gradient(110deg, var(--c) 35%, color-mix(in srgb, var(--c) 20%, #fff) 50%, var(--c) 65%) 100% 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: txt-staggered-shine-text-glint 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  animation-delay: calc(var(--i) * 70ms);
}
@keyframes txt-staggered-shine-text-glint {
  0%        { background-position: 100% 0; transform: translateY(0); }
  16%       { transform: translateY(-0.06em); }
  34%, 100% { background-position: 0% 0; transform: translateY(0); }
}

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