08斜めストライプ移動
45度に傾けた repeating-linear-gradient の縞模様を、その斜め方向に background-position で動かし、ストライプが行進するように流れさせる。
使いどころセール・プロモバナーの背景、処理中(processing)状態の背景
repeating-linear-gradient45degbackground-position

<main class="stage">
<p class="hint">プロモバナー</p>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: $dur-loop; // 줄무늬 한 칸만큼 행진하는 시간
$easing: linear;
$color: $subject-blue; // 줄무늬 색
// ── 데모 무대 ──────────────────────────────────────────
@include stage($stage-paper);
.stage {
position: relative;
overflow: hidden;
}
// 세로 줄무늬를 그린 뒤 통째로 45도 회전시켜 대각선으로 보이게 하고, background-position 은 회전 전 좌표계에서 가로로만 한 칸(36px) 이동시킨다
// (45deg 로 기울인 채로 background-position 을 대각선으로 움직이면 이동 방향이 줄무늬와 나란해져 화면이 안 바뀐다 — 실측 2026-09-09)
.stage::before {
content: "";
position: absolute;
inset: -150% -150%;
transform: rotate(45deg);
background-image: repeating-linear-gradient(90deg, rgba($color, .18) 0 18px, transparent 18px 36px);
animation: stripemove $duration $easing infinite;
}
.hint {
position: relative;
margin: 0;
padding: 10px 20px;
border-radius: $r-pill;
background: rgba($stage-ink, .08);
color: $stage-ink;
font: 700 clamp(14px, 4vw, 18px)/1.3 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}
@keyframes stripemove {
from { background-position: 0 0; }
to { background-position: 36px 0; }
}
@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: #ffffff;
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: -150% -150%;
transform: rotate(45deg);
background-image: repeating-linear-gradient(90deg, rgba(47, 109, 246, 0.18) 0 18px, transparent 18px 36px);
animation: stripemove 2s linear infinite;
}
.hint {
position: relative;
margin: 0;
padding: 10px 20px;
border-radius: 999px;
background: rgba(23, 20, 26, 0.08);
color: #17141a;
font: 700 clamp(14px, 4vw, 18px)/1.3 -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
}
@keyframes stripemove {
from {
background-position: 0 0;
}
to {
background-position: 36px 0;
}
}
@media (prefers-reduced-motion: reduce) {
.stage::before {
animation: none;
}
}import type { CSSProperties, ReactNode } from "react";
import styles from "./StripesDiagonalBg.module.scss";
export type StripesDiagonalBgProps = {
children?: ReactNode;
/** 줄무늬 한 칸만큼 행진하는 시간 (기본 2000ms) */
duration?: number;
/** 줄무늬 색 */
color?: string;
className?: string;
};
type Vars = CSSProperties & { "--duration"?: string; "--color"?: string };
export default function StripesDiagonalBg({
children,
duration = 2000,
color = "#2f6df6",
className = "",
}: StripesDiagonalBgProps) {
const vars: Vars = { "--duration": `${duration}ms`, "--color": color };
return (
<div className={`${styles.stage} ${className}`} style={vars}>
<div className={styles.stripes} aria-hidden="true" />
{children}
</div>
);
}08 斜めストライプ移動 — 計測 累積面積 99.674% · 動いたフレーム 23/23GODRICH オリジナル · SCSS と React は zip に同梱 · CSS 背景 アニメーション 9選 — 一行でコピペOK
このデモが属する記事
CSS 背景 アニメーション 9選 — 一行でコピペOKcss 背景 アニメーションは、CSSだけで背景を動かし続ける手法です。この記事では9種類を選び、background-positionとtransform、filter: blurという仕組みだけで実装しました。グリッドの9つはifram この記事のデモをすべて見る


