AI CSS Animations

Conic Gradient Text

A conic gradient turns inside the letters, so the colors sweep around the word like a slow radar. The angle is a registered @property, which is what lets a gradient animate at all.

Also known as: spinning gradient text, rotating gradient text css, conic gradient animation.

Full Circle

HTML

<div class="txt-conic-gradient-text">Full Circle</div>

CSS

@property --txt-conic-gradient-text-a {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
.txt-conic-gradient-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;
  background: conic-gradient(from var(--txt-conic-gradient-text-a) at 50% 50%,
    var(--c), color-mix(in srgb, var(--c) 30%, #22d3ee), color-mix(in srgb, var(--c) 35%, #a855f7), color-mix(in srgb, var(--c) 30%, #ec4899), var(--c));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: txt-conic-gradient-text-spin 4s linear infinite;}
@keyframes txt-conic-gradient-text-spin {
  to { --txt-conic-gradient-text-a: 360deg; }
}

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