Morphing Blob
有机形状变形
A rounded shape slowly changes its outline from one irregular form to another.
Where to use it
Add a soft animated accent beside a short hero headline. Keep the shape inside a fixed footprint so controls and text hold their positions as the outline changes.
Practical example
A guided-breathing library places a teal shape beside the title of its wind-down course. The shape slowly rounds and stretches within the same frame while visitors read the course length and choose an audio session.
AI prompt
Animate the outline of [target accent] with a Morphing Blob. Keyframe paired horizontal and vertical border-radius values across three organic shapes. Keep the element box fixed and use the initial border radius with reduced motion.
Example code
Save the standalone HTML as a file and open it in your browser. It uses the same code as the preview.
View HTML
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Morphing Blob</title>
<style>
:root {
color-scheme: dark;
--demo-bg: #171629;
--demo-ink: #f8f5ff;
--demo-accent: #b9a6ff;
--demo-muted: #bfbbd3;
font-family: system-ui, sans-serif;
color: var(--demo-ink);
background: var(--demo-bg);
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 0; }
button, input { font: inherit; }
.demo {
display: grid;
place-items: center;
align-content: center;
min-height: 100vh;
padding: 14px;
overflow: hidden;
background: radial-gradient(ellipse at 50% 24%, #28233f, var(--demo-bg) 78%);
}
.demo-button {
border: 1px solid #ffffff3d;
border-radius: 7px;
background: #ffffff12;
color: var(--demo-ink);
padding: 6px 11px;
font-size: 12px;
cursor: pointer;
}
:focus-visible {
outline: 2px solid var(--demo-accent);
outline-offset: 3px;
}
.organic-blob {
width: 114px; height: 89px; border-radius: 64% 36% 44% 56% / 46% 53% 47% 54%;
background: radial-gradient(ellipse at 30% 28%, #ffe573, #f58768 55%, #b353b7);
box-shadow: inset 0 0 21px #fff4c663, 0 13px 26px #c96da558;
animation: morph 5.2s ease-in-out infinite;
}
@keyframes morph {
42% { border-radius: 36% 64% 70% 30% / 59% 38% 62% 41%; }
74% { border-radius: 49% 51% 28% 72% / 70% 64% 36% 30%; }
}
.motion-example { display: grid; justify-items: center; width: 100%; gap: 10px; }
.motion-specimen {
display: grid;
place-items: center;
width: min(100%, 295px);
height: 108px;
position: relative;
isolation: isolate;
}
.motion-example [data-motion] { animation-play-state: paused; }
.motion-example[data-playing] [data-motion] { animation-play-state: running; }
@media (prefers-reduced-motion: reduce) {
.motion-example [data-motion] { animation: none; }
.motion-example [data-loop-toggle] { display: none; }
}
</style>
</head>
<body>
<main class="demo">
<div class="motion-example">
<div class="motion-specimen" aria-hidden="true"><div class="organic-blob" data-motion></div></div>
<button class="demo-button" type="button" data-loop-toggle data-testid="effect-demo-loop-toggle">Play demo</button>
</div>
</main>
<script>
const example = document.querySelector('.motion-example');
const toggle = example.querySelector('[data-loop-toggle]');
toggle.addEventListener('click', () => {
const playing = example.toggleAttribute('data-playing');
toggle.textContent = playing ? "Pause demo" : "Play demo";
});
</script>
</body>
</html>Original example by UI Skills