AI CSS Animations

Morphing Blob Button

A round voice button whose gradient body keeps morphing like a drop of liquid, with a softer blob breathing out of phase behind it. The shape is eight border-radius values animated while it turns.

Also known as: blob button css, voice assistant button, organic shape animation css.

HTML

<button class="btn-morphing-blob" type="button" aria-label="Start voice input">
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5.5 11a6.5 6.5 0 0 0 13 0M12 17.5V21"/></svg>
</button>

CSS

.btn-morphing-blob {
  --c: var(--btn-color, #3b82f6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.75em 1.6em;
  border: 0;
  border-radius: 0.6em;
  font: 600 var(--btn-size, 18px)/1.1 system-ui, sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  isolation: isolate;
  width: 4.6em;
  height: 4.6em;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);}
.btn-morphing-blob::before,
.btn-morphing-blob::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 42% 58% 62% 38% / 45% 42% 58% 55%;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 35%, #ec4899));
  animation:
    btn-morphing-blob-morph 6s ease-in-out infinite,
    btn-morphing-blob-turn 12s linear infinite;
}
.btn-morphing-blob::before {
  inset: -0.55em;
  opacity: 0.3;
  animation-duration: 7s, 16s;
  animation-direction: alternate, reverse;
}
.btn-morphing-blob svg {
  width: 1.7em;
  height: 1.7em;
}
.btn-morphing-blob:is(:hover, :focus-visible) { transform: scale(1.06); }
.btn-morphing-blob:active { transform: scale(0.92); }
@keyframes btn-morphing-blob-morph {
  0%, 100% { border-radius: 42% 58% 62% 38% / 45% 42% 58% 55%; }
  33%      { border-radius: 60% 40% 38% 62% / 55% 60% 40% 45%; }
  66%      { border-radius: 38% 62% 55% 45% / 62% 38% 62% 38%; }
}
@keyframes btn-morphing-blob-turn {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .btn-morphing-blob, .btn-morphing-blob *, .btn-morphing-blob::before, .btn-morphing-blob::after, .btn-morphing-blob *::before, .btn-morphing-blob *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

Customizing this snippet

  • Color: set --btn-color on the element or a parent. Currently previewing #3b82f6.
  • Base size: set --btn-size. Every other dimension is in em, so the whole thing scales together. Currently previewing 18px.
  • 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 buttons