02メッシュグラデーションの漂い
色の異なる radial-gradient のにじみを3〜4枚重ね、それぞれ異なる周期・経路で transform: translate させることで、にじみが有機的に混ざり合うメッシュグラデーションを作る。
使いどころSaaSランディングのヒーロー背景、アプリオンボーディング画面の背景
radial-gradient 레이어transform: translate비동기 주기

<main class="stage">
<span class="blob b1" aria-hidden="true"></span>
<span class="blob b2" aria-hidden="true"></span>
<span class="blob b3" aria-hidden="true"></span>
<p class="hint">SaaSランディング</p>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: $dur-loop; // 얼룩 하나가 경로를 한 바퀴 도는 시간
$easing: $ease-spring;
$color: $subject-blue; // 얼룩 색 하나
// ── 데모 무대 ──────────────────────────────────────────
@include stage($stage-yellow);
.stage {
position: relative;
overflow: hidden;
}
// 서로 다른 색의 radial-gradient 얼룩 세 개를 겹치고, transform 으로만 각자 다른 경로를 돈다
.blob {
position: absolute;
width: 42%;
aspect-ratio: 1;
border-radius: 50%;
filter: blur(12px);
opacity: .9;
}
.b1 { background: radial-gradient($color, transparent 65%); top: -8%; left: -6%; animation: drift1 $duration $easing infinite; }
.b2 { background: radial-gradient($subject-cream, transparent 65%); bottom: -12%; right: -4%; animation: drift2 $duration $easing infinite; animation-delay: -.6s; }
.b3 { background: radial-gradient($stage-ink, transparent 65%); top: 28%; right: 22%; opacity: .65; animation: drift3 $duration $easing infinite; animation-delay: -1.2s; }
@keyframes drift1 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(48px, 32px); } }
@keyframes drift2 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-42px, -26px); } }
@keyframes drift3 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(24px, -38px); } }
.hint {
position: relative;
margin: 0;
padding: 10px 20px;
border-radius: $r-pill;
background: rgba($stage-ink, .15);
color: $stage-ink;
font: 700 clamp(14px, 4vw, 18px)/1.3 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}
@media (prefers-reduced-motion: reduce) {
.blob { animation: none; }
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #ffd23f;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.stage {
position: relative;
overflow: hidden;
}
.blob {
position: absolute;
width: 42%;
aspect-ratio: 1;
border-radius: 50%;
filter: blur(12px);
opacity: 0.9;
}
.b1 {
background: radial-gradient(#2f6df6, transparent 65%);
top: -8%;
left: -6%;
animation: drift1 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}
.b2 {
background: radial-gradient(#fff7e6, transparent 65%);
bottom: -12%;
right: -4%;
animation: drift2 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
animation-delay: -0.6s;
}
.b3 {
background: radial-gradient(#17141a, transparent 65%);
top: 28%;
right: 22%;
opacity: 0.65;
animation: drift3 2s cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
animation-delay: -1.2s;
}
@keyframes drift1 {
0%, 100% {
transform: translate(0, 0);
}
50% {
transform: translate(48px, 32px);
}
}
@keyframes drift2 {
0%, 100% {
transform: translate(0, 0);
}
50% {
transform: translate(-42px, -26px);
}
}
@keyframes drift3 {
0%, 100% {
transform: translate(0, 0);
}
50% {
transform: translate(24px, -38px);
}
}
.hint {
position: relative;
margin: 0;
padding: 10px 20px;
border-radius: 999px;
background: rgba(23, 20, 26, 0.15);
color: #17141a;
font: 700 clamp(14px, 4vw, 18px)/1.3 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}
@media (prefers-reduced-motion: reduce) {
.blob {
animation: none;
}
}import type { CSSProperties, ReactNode } from "react";
import styles from "./MeshGradientBg.module.scss";
export type MeshGradientBgProps = {
children?: ReactNode;
/** 얼룩 하나가 경로를 한 바퀴 도는 시간 (기본 2000ms) */
duration?: number;
easing?: string;
/** 얼룩 색 하나 */
color?: string;
className?: string;
};
type Vars = CSSProperties & { "--duration"?: string; "--easing"?: string; "--color"?: string };
export default function MeshGradientBg({
children,
duration = 2000,
easing = "cubic-bezier(.2,.8,.2,1)",
color = "#2f6df6",
className = "",
}: MeshGradientBgProps) {
const vars: Vars = { "--duration": `${duration}ms`, "--easing": easing, "--color": color };
return (
<div className={`${styles.stage} ${className}`} style={vars}>
<span className={`${styles.blob} ${styles.b1}`} aria-hidden="true" />
<span className={`${styles.blob} ${styles.b2}`} aria-hidden="true" />
<span className={`${styles.blob} ${styles.b3}`} aria-hidden="true" />
{children}
</div>
);
}02 メッシュグラデーションの漂い — 計測 累積面積 52.819% · 動いたフレーム 15/23GODRICH オリジナル · SCSS と React は zip に同梱 · CSS 背景 アニメーション 9選 — 一行でコピペOK
このデモが属する記事
CSS 背景 アニメーション 9選 — 一行でコピペOKcss 背景 アニメーションは、CSSだけで背景を動かし続ける手法です。この記事では9種類を選び、background-positionとtransform、filter: blurという仕組みだけで実装しました。グリッドの9つはifram この記事のデモをすべて見る


