AI CSS Animations

Iridescent Text Effect

An oil-slick sheen where every color shifts in place, without the gradient ever moving. It is one static gradient under a hue-rotate filter that turns a full circle.

Also known as: oil slick text, hue rotate text animation, color shifting text css.

Iridescent

HTML

<div class="txt-iridescent-text">Iridescent</div>

CSS

.txt-iridescent-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:
    radial-gradient(ellipse 45% 110% at 18% 25%, color-mix(in srgb, var(--c) 35%, #ec4899), transparent 70%),
    radial-gradient(ellipse 45% 110% at 82% 75%, color-mix(in srgb, var(--c) 35%, #14b8a6), transparent 70%),
    linear-gradient(120deg, var(--c), color-mix(in srgb, var(--c) 45%, #8b5cf6) 50%, var(--c));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: txt-iridescent-text-shift 6s linear infinite;}
@keyframes txt-iridescent-text-shift {
  to { filter: hue-rotate(360deg); }
}

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