09線が伸びるタイムライン
スクロールした分だけ縦線が伸び、通過した点が点灯する。
使いどころ沿革・手順・ロードマップ
2px가로형점 없이

<main class="stage">
<ul class="timeline is-demo">
<li class="timeline__step"><span class="timeline__dot"></span>企画</li>
<li class="timeline__step"><span class="timeline__dot"></span>デザイン</li>
<li class="timeline__step"><span class="timeline__dot"></span>リリース</li>
<li class="timeline__line" aria-hidden="true"></li>
</ul>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개. 변형은 이것만 바꾼다 (값은 토큰에서 받는다) ──────
$thickness: 2px; // 선 두께
$color: $subject-cream; // 선·점 색 (ink 무대라 cream)
$duration: $dur-enter; // 점 하나가 켜지는 시간
// ── 데모 무대 (zip 에서 지워도 된다) ──────────────────────────
@include stage($stage-ink);
// ── 세로 타임라인 ────────────────────────────────────
.timeline {
position: relative;
margin: 0;
padding: 0 0 0 28px;
list-style: none;
color: #fff;
font-weight: 500;
font-size: 14px;
line-height: 1;
font-family: inherit;
&__step {
position: relative;
padding: clamp(4px, 2vw, 6px) 0;
margin-bottom: clamp(10px, 6vw, 26px); // 320×200 에서도 세 단계가 들어가게 줄인다
&:last-of-type { margin-bottom: 0; }
}
&__dot {
position: absolute;
left: -28px;
top: 8px;
width: 10px;
height: 10px;
border-radius: 50%;
background: $color; // 색은 고정. 켜짐/꺼짐은 opacity 로만 표현
opacity: .28;
transform: scale(1);
// ── 실제 사용 코드: 점마다 제 위치에서 뷰포트에 들어오면 켜진다 ──
@supports (animation-timeline: view()) {
animation: dot-light $duration ease-out both;
animation-timeline: view();
animation-range: entry 30% cover 60%;
}
@supports not (animation-timeline: view()) {
opacity: 1;
}
}
// ── 선: 세로로 그어진다. 실제 사용 코드는 문서 스크롤 진행률에 맞춘다 ──
&__line {
position: absolute;
left: -23px;
top: 8px;
width: $thickness;
height: calc(100% - 16px);
background: $color;
transform: scaleY(0);
transform-origin: top; // 규칙8: 세로선 top에서 차오름
@supports (animation-timeline: scroll()) {
animation: line-draw linear both;
animation-timeline: scroll(root);
animation-range: 0 200px;
}
@supports not (animation-timeline: scroll()) {
transform: scaleY(1);
}
}
}
@keyframes dot-light { from { opacity: .28; transform: scale(1); } to { opacity: 1; transform: scale(1.3); } }
@keyframes line-draw { from { transform: scaleY(0); } to { transform: scaleY(1); } }
// ── 데모(.is-demo): 스크롤 대신 2초 루프로 흉내 (선이 먼저, 점은 순서대로) ──
.timeline.is-demo .timeline__line {
animation: line-draw-loop $dur-loop ease-in-out infinite;
}
.timeline.is-demo .timeline__step:nth-child(1) .timeline__dot { animation: dot-loop $dur-loop ease-out infinite; animation-delay: 0ms; }
.timeline.is-demo .timeline__step:nth-child(2) .timeline__dot { animation: dot-loop $dur-loop ease-out infinite; animation-delay: 160ms; }
.timeline.is-demo .timeline__step:nth-child(3) .timeline__dot { animation: dot-loop $dur-loop ease-out infinite; animation-delay: 320ms; }
@keyframes line-draw-loop {
0% { transform: scaleY(0); }
60% { transform: scaleY(1); }
100% { transform: scaleY(1); }
}
@keyframes dot-loop {
0% { opacity: .28; transform: scale(1); }
15% { opacity: 1; transform: scale(1.3); }
70% { opacity: 1; transform: scale(1); }
85% { opacity: .28; transform: scale(1); }
100% { opacity: .28; transform: scale(1); }
}
// ── 접근성: 움직임 줄이기 설정이면 다 켜진 상태로 고정 ────────
@media (prefers-reduced-motion: reduce) {
.timeline__line, .timeline.is-demo .timeline__line { animation: none !important; transform: scaleY(1); }
.timeline__dot, .timeline.is-demo .timeline__step .timeline__dot { animation: none !important; opacity: 1; transform: scale(1); }
}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);
}
.timeline {
position: relative;
margin: 0;
padding: 0 0 0 28px;
list-style: none;
color: #fff;
font-weight: 500;
font-size: 14px;
line-height: 1;
font-family: inherit;
}
.timeline__step {
position: relative;
padding: clamp(4px, 2vw, 6px) 0;
margin-bottom: clamp(10px, 6vw, 26px);
}
.timeline__step:last-of-type {
margin-bottom: 0;
}
.timeline__dot {
position: absolute;
left: -28px;
top: 8px;
width: 10px;
height: 10px;
border-radius: 50%;
background: #fff7e6;
opacity: 0.28;
transform: scale(1);
}
@supports (animation-timeline: view()) {
.timeline__dot {
animation: dot-light 600ms ease-out both;
animation-timeline: view();
animation-range: entry 30% cover 60%;
}
}
@supports not (animation-timeline: view()) {
.timeline__dot {
opacity: 1;
}
}
.timeline__line {
position: absolute;
left: -23px;
top: 8px;
width: 2px;
height: calc(100% - 16px);
background: #fff7e6;
transform: scaleY(0);
transform-origin: top;
}
@supports (animation-timeline: scroll()) {
.timeline__line {
animation: line-draw linear both;
animation-timeline: scroll(root);
animation-range: 0 200px;
}
}
@supports not (animation-timeline: scroll()) {
.timeline__line {
transform: scaleY(1);
}
}
@keyframes dot-light {
from {
opacity: 0.28;
transform: scale(1);
}
to {
opacity: 1;
transform: scale(1.3);
}
}
@keyframes line-draw {
from {
transform: scaleY(0);
}
to {
transform: scaleY(1);
}
}
.timeline.is-demo .timeline__line {
animation: line-draw-loop 2s ease-in-out infinite;
}
.timeline.is-demo .timeline__step:nth-child(1) .timeline__dot {
animation: dot-loop 2s ease-out infinite;
animation-delay: 0ms;
}
.timeline.is-demo .timeline__step:nth-child(2) .timeline__dot {
animation: dot-loop 2s ease-out infinite;
animation-delay: 160ms;
}
.timeline.is-demo .timeline__step:nth-child(3) .timeline__dot {
animation: dot-loop 2s ease-out infinite;
animation-delay: 320ms;
}
@keyframes line-draw-loop {
0% {
transform: scaleY(0);
}
60% {
transform: scaleY(1);
}
100% {
transform: scaleY(1);
}
}
@keyframes dot-loop {
0% {
opacity: 0.28;
transform: scale(1);
}
15% {
opacity: 1;
transform: scale(1.3);
}
70% {
opacity: 1;
transform: scale(1);
}
85% {
opacity: 0.28;
transform: scale(1);
}
100% {
opacity: 0.28;
transform: scale(1);
}
}
@media (prefers-reduced-motion: reduce) {
.timeline__line, .timeline.is-demo .timeline__line {
animation: none !important;
transform: scaleY(1);
}
.timeline__dot, .timeline.is-demo .timeline__step .timeline__dot {
animation: none !important;
opacity: 1;
transform: scale(1);
}
}import type { CSSProperties } from "react";
import styles from "./LineDrawTimeline.module.scss";
export type LineDrawTimelineProps = {
steps: string[];
/** 선 두께 (기본 2px) */
thickness?: number;
/** 선·점 색 (기본 cream) */
color?: string;
className?: string;
};
type Vars = CSSProperties & { "--thickness"?: string; "--color"?: string };
export default function LineDrawTimeline({
steps,
thickness = 2,
color = "#fff7e6",
className = "",
}: LineDrawTimelineProps) {
const vars: Vars = { "--thickness": `${thickness}px`, "--color": color };
return (
<ul className={`${styles.timeline} ${className}`} style={vars}>
{steps.map((step) => (
<li key={step} className={styles.step}>
<span className={styles.dot} />
{step}
</li>
))}
<li className={styles.line} aria-hidden="true" />
</ul>
);
}09 線が伸びるタイムライン — 計測 累積面積 0.553% · 動いたフレーム 23/23GODRICH オリジナル · SCSS と React は zip に同梱 · 【コピペOK】スクロール アニメーション CSS のみ 9選
このデモが属する記事
【コピペOK】スクロール アニメーション CSS のみ 9選スクロール アニメーション css は、要素が画面に入った量やページ全体の読了率を animation-timeline に渡し、JavaScript を1行も書かずに動かす仕組みです。この記事では9種類を選び、view() と scrol この記事のデモをすべて見る


