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 オリジナル · SCSS と React は zip に同梱 · 【コピペOK】css テキスト アニメーション 9選
このデモが属する記事
【コピペOK】css テキスト アニメーション 9選css テキスト アニメーション とは、見出しや文章が画面に現れるときに一緒に動く演出のことです。見出しを一気に引き立てる一瞬のつくり方を9つ集めました。そのうち1つは、暗号が解けるように文字がそろいます。 この記事のデモをすべて見る


