01그라디언트 흐름
배경을 실제 화면보다 두 배 크게 깔고 background-position 만 오가게 해 그라데이션이 물결처럼 흐르는 것처럼 보이게 한다.
쓰임히어로 섹션 배경, 프리미엄 CTA 버튼 배경
background-position220% 220%$ease-out

<main class="stage">
<p class="hint">히어로 배경</p>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개. 변형은 이것만 바꾼다 ──────────────────────────
$duration: $dur-loop; // 그라데이션이 한 바퀴 흐르는 시간
$easing: $ease-out;
$color: $subject-blue; // 흐르는 그라데이션의 포인트 색
// ── 데모 무대 ──────────────────────────────────────────
@include stage($stage-ink);
.stage {
position: relative;
overflow: hidden;
}
// 실제 배경은 스테이지보다 두 배 크게 깔고 background-position 만 움직인다 (transform·opacity 만 쓰는 규칙의 배경판)
.stage::before {
content: "";
position: absolute;
inset: 0;
background-image: linear-gradient(120deg, $stage-ink, $color, $subject-cream, $stage-ink);
background-size: 220% 220%;
animation: flow $duration $easing infinite;
}
.hint {
position: relative;
margin: 0;
padding: 10px 20px;
border-radius: $r-pill;
background: rgba($stage-ink, .35);
color: $stage-paper;
font: 700 clamp(14px, 4vw, 18px)/1.3 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}
@keyframes flow {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
// ── 접근성: 움직임 줄이기 설정이면 정지 프레임만 ────────────
@media (prefers-reduced-motion: reduce) {
.stage::before { animation: none; background-position: 0% 50%; }
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #17141a;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.stage {
position: relative;
overflow: hidden;
}
.stage::before {
content: "";
position: absolute;
inset: 0;
background-image: linear-gradient(120deg, #17141a, #2f6df6, #fff7e6, #17141a);
background-size: 220% 220%;
animation: flow 2s ease-out infinite;
}
.hint {
position: relative;
margin: 0;
padding: 10px 20px;
border-radius: 999px;
background: rgba(23, 20, 26, 0.35);
color: #ffffff;
font: 700 clamp(14px, 4vw, 18px)/1.3 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}
@keyframes flow {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
@media (prefers-reduced-motion: reduce) {
.stage::before {
animation: none;
background-position: 0% 50%;
}
}import type { CSSProperties, ReactNode } from "react";
import styles from "./GradientShiftBg.module.scss";
export type GradientShiftBgProps = {
children?: ReactNode;
/** 한 바퀴 흐르는 시간 (기본 2000ms) */
duration?: number;
easing?: string;
/** 흐르는 그라데이션의 포인트 색 */
color?: string;
className?: string;
};
type Vars = CSSProperties & { "--duration"?: string; "--easing"?: string; "--color"?: string };
export default function GradientShiftBg({
children,
duration = 2000,
easing = "ease-out",
color = "#2f6df6",
className = "",
}: GradientShiftBgProps) {
const vars: Vars = { "--duration": `${duration}ms`, "--easing": easing, "--color": color };
return (
<div className={`${styles.stage} ${className}`} style={vars}>
<div className={styles.bg} aria-hidden="true" />
{children}
</div>
);
}01 그라디언트 흐름 — 측정 누적면적 99.739% · 움직인 프레임 20/23GODRICH 원작 · zip 에 SCSS·React 포함 · CSS 배경 애니메이션 9종 — 한 줄 복붙으로
이 데모가 속한 글
CSS 배경 애니메이션 9종 — 한 줄 복붙으로CSS 배경 애니메이션은 히어로 섹션이나 카드 뒤에서 이미지 파일 없이 그라데이션·격자·점·노이즈 같은 패턴을 계속 움직이게 만드는 기법입니다. 아홉 개를 모았는데, 그중 하나는 커서를 따라가는 스포트라이트라 마우스 이 글의 데모 전부 보기

