06ノイズグレイン
極小の repeating-conic-gradient タイルを敷き詰め、background-position を steps() で毎フレーム飛ばすことで、フィルムグレインのようにチラつく質感を作る。
使いどころダークヒーローのテクスチャオーバーレイ、プレミアムカード背景のノイズ
repeating-conic-gradientsteps()background-position

<main class="stage">
<p class="hint">プレミアムカード</p>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: $dur-loop; // 그레인 지글거림이 한 바퀴 도는 시간
$easing: steps(40); // 프레임을 건너뛰어야 그레인처럼 보인다 (부드러운 이징 금지)
$color: $stage-ink; // 그레인 점 색
// ── 데모 무대 ──────────────────────────────────────────
@include stage($stage-yellow);
.stage {
position: relative;
overflow: hidden;
}
// 아주 작은 conic-gradient 타일을 반복시키고 background-position 을 steps() 로 매 프레임 건너뛴다
.stage::before {
content: "";
position: absolute;
inset: 0;
background-image: repeating-conic-gradient(from 0deg, rgba($color, .55) 0deg 90deg, transparent 90deg 180deg);
background-size: 3px 3px;
opacity: .35;
animation: grain $duration $easing infinite;
}
.hint {
position: relative;
margin: 0;
padding: 10px 20px;
border-radius: $r-pill;
background: rgba($stage-ink, .12);
color: $stage-ink;
font: 700 clamp(14px, 4vw, 18px)/1.3 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}
@keyframes grain {
from { background-position: 0 0; }
to { background-position: 117px 69px; }
}
@media (prefers-reduced-motion: reduce) {
.stage::before { 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;
}
.stage::before {
content: "";
position: absolute;
inset: 0;
background-image: repeating-conic-gradient(from 0deg, rgba(23, 20, 26, 0.55) 0deg 90deg, transparent 90deg 180deg);
background-size: 3px 3px;
opacity: 0.35;
animation: grain 2s steps(40) infinite;
}
.hint {
position: relative;
margin: 0;
padding: 10px 20px;
border-radius: 999px;
background: rgba(23, 20, 26, 0.12);
color: #17141a;
font: 700 clamp(14px, 4vw, 18px)/1.3 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}
@keyframes grain {
from {
background-position: 0 0;
}
to {
background-position: 117px 69px;
}
}
@media (prefers-reduced-motion: reduce) {
.stage::before {
animation: none;
}
}import type { CSSProperties, ReactNode } from "react";
import styles from "./NoiseGrainBg.module.scss";
export type NoiseGrainBgProps = {
children?: ReactNode;
/** 그레인 지글거림이 한 바퀴 도는 시간 (기본 2000ms) */
duration?: number;
/** 그레인 점 색 */
color?: string;
className?: string;
};
type Vars = CSSProperties & { "--duration"?: string; "--color"?: string };
export default function NoiseGrainBg({
children,
duration = 2000,
color = "#17141a",
className = "",
}: NoiseGrainBgProps) {
const vars: Vars = { "--duration": `${duration}ms`, "--color": color };
return (
<div className={`${styles.stage} ${className}`} style={vars}>
<div className={styles.grain} aria-hidden="true" />
{children}
</div>
);
}06 ノイズグレイン — 計測 累積面積 99.705% · 動いたフレーム 21/23GODRICH オリジナル · SCSS と React は zip に同梱 · CSS 背景 アニメーション 9選 — 一行でコピペOK
このデモが属する記事
CSS 背景 アニメーション 9選 — 一行でコピペOKcss 背景 アニメーションは、CSSだけで背景を動かし続ける手法です。この記事では9種類を選び、background-positionとtransform、filter: blurという仕組みだけで実装しました。グリッドの9つはifram この記事のデモをすべて見る


