01단어 단위 떠오르기
문장이 단어 단위로 끊어져 아래에서 위로 하나씩 떠오르며 나타납니다. 글자 하나하나가 아니라 단어 덩어리로 움직여 읽기 편한 속도로 보입니다.
쓰임본문 도입 문단, 자기소개 페이지 인트로 문장
display:inline-blocktranslateYanimation-delay

<main class="stage">
<p class="ws-line is-demo">
<span class="ws-word">Ship</span>
<span class="ws-word">It</span>
<span class="ws-word">Beautifully</span>
</p>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: $dur-loop;
$easing: $ease-out;
$color: $subject-cream;
@include stage($stage-ink);
.ws-line {
margin: 0;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: $sp-2;
font: 700 clamp(22px, 6vw, 34px)/1.2 -apple-system, "Segoe UI", sans-serif;
color: $color;
}
.ws-word {
display: inline-block;
opacity: 0;
transform: translateY($sp-4);
filter: blur(var(--blur, 6px));
}
// 데모 루프: 단어가 하나씩 지연을 두고 떠올랐다가 다시 가라앉아 반복 재생된다 (캡처용)
// 한 겹: 단어별 관성 lerp + blur→focus — 등장 구간(0→20%)을 $ease-lerp-settle 로 목표를 살짝 지나쳤다
// 되돌아오게 하고, 단어마다 --blur 깊이(6→9→12px)를 달리해 무거운 단어일수록 늦게 초점이 맞는다.
@keyframes ws-rise {
0% { opacity: 0; transform: translateY($sp-4); filter: blur(var(--blur, 6px)); animation-timing-function: $ease-lerp-settle; }
20%, 80% { opacity: 1; transform: none; filter: blur(0); }
100% { opacity: 0; transform: translateY($sp-4); filter: blur(var(--blur, 6px)); }
}
.ws-line.is-demo .ws-word { animation: ws-rise $duration $easing infinite; }
.ws-line.is-demo .ws-word:nth-child(2) { animation-delay: 160ms; --blur: 9px; }
.ws-line.is-demo .ws-word:nth-child(3) { animation-delay: 320ms; --blur: 12px; }
@media (prefers-reduced-motion: reduce) {
.ws-word,
.ws-line.is-demo .ws-word {
animation: none !important;
opacity: 1 !important;
transform: none !important;
filter: none !important;
}
}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);
}
.ws-line {
margin: 0;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 8px;
font: 700 clamp(22px, 6vw, 34px)/1.2 -apple-system, "Segoe UI", sans-serif;
color: #fff7e6;
}
.ws-word {
display: inline-block;
opacity: 0;
transform: translateY(16px);
filter: blur(var(--blur, 6px));
}
@keyframes ws-rise {
0% {
opacity: 0;
transform: translateY(16px);
filter: blur(var(--blur, 6px));
animation-timing-function: linear(0, 0.051, 0.176, 0.341, 0.518, 0.685, 0.831, 0.947, 1.032, 1.087, 1.117, 1.126, 1.121, 1.105, 1.085, 1.062, 1.041, 1.022, 1.008, 0.997, 1);
}
20%, 80% {
opacity: 1;
transform: none;
filter: blur(0);
}
100% {
opacity: 0;
transform: translateY(16px);
filter: blur(var(--blur, 6px));
}
}
.ws-line.is-demo .ws-word {
animation: ws-rise 2s ease-out infinite;
}
.ws-line.is-demo .ws-word:nth-child(2) {
animation-delay: 160ms;
--blur: 9px;
}
.ws-line.is-demo .ws-word:nth-child(3) {
animation-delay: 320ms;
--blur: 12px;
}
@media (prefers-reduced-motion: reduce) {
.ws-word,
.ws-line.is-demo .ws-word {
animation: none !important;
opacity: 1 !important;
transform: none !important;
filter: none !important;
}
}import { CSSProperties, useEffect, useRef, useState } from "react";
import styles from "./WordStaggerFade.module.scss";
export interface WordStaggerFadeProps {
words?: string[];
duration?: string;
easing?: string;
stagger?: string;
}
// 실사용: IntersectionObserver 가 문장이 뷰포트에 들어올 때 한 번 in 을 켠다. 단어마다 transition-delay 만 다르다.
export default function WordStaggerFade({
words = ["Ship", "It", "Beautifully"],
duration = "500ms",
easing = "ease-out",
stagger = "140ms",
}: WordStaggerFadeProps) {
const ref = useRef<HTMLParagraphElement>(null);
const [inView, setInView] = useState(false);
useEffect(() => {
const el = ref.current;
if (!el) return;
const io = new IntersectionObserver((entries) => {
entries.forEach((e) => { if (e.isIntersecting) { setInView(true); io.unobserve(e.target); } });
}, { threshold: 0.3 });
io.observe(el);
return () => io.disconnect();
}, []);
const style = { "--duration": duration, "--easing": easing } as CSSProperties;
return (
<p className={styles.line} style={style} ref={ref}>
{words.map((w, i) => (
<span
key={w + i}
className={`${styles.word} ${inView ? styles.in : ""}`}
style={{ transitionDelay: inView ? `calc(${stagger} * ${i})` : undefined }}
>
{w}
</span>
))}
</p>
);
}01 단어 단위 떠오르기 — 측정 누적면적 5.099% · 움직인 프레임 13/23GODRICH 원작 · zip 에 SCSS·React 포함 · CSS 텍스트 애니메이션 9종 — 등장·강조 모음
이 데모가 속한 글
CSS 텍스트 애니메이션 9종 — 등장·강조 모음CSS 텍스트 애니메이션은 제목이나 문장이 화면에 나타나거나 강조될 때 함께 움직이는 효과로, 코드를 몰라도 파일을 그대로 붙이면 바로 쓸 수 있습니다. 제목 하나로 눈길 끄는 그 짧은 순간을 만드는 아홉 가지 방법 이 글의 데모 전부 보기


