04줄마다 엇갈려 슬라이드
여러 줄짜리 문단에서 홀수 줄은 왼쪽, 짝수 줄은 오른쪽에서 밀려 들어와 지그재그로 자리를 잡습니다.
쓰임선언문·미션 문구 섹션, 2~3줄짜리 긴 헤드라인
translateXanimation-delay: 160msalternating delay

<main class="stage">
<div class="ls-block is-demo">
<p class="ls-line ls-line--l">DESIGN WITH</p>
<p class="ls-line ls-line--r">INTENTION</p>
</div>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: $dur-loop;
$easing: $ease-lerp-settle; // 관성 lerp — 줄마다 목표 위치를 살짝 지나쳤다 정착한다 (2026-09-15 형태 2차 한 겹)
$color: $subject-blue;
@include stage($stage-paper);
.ls-block {
display: grid;
gap: $sp-1;
text-align: center;
}
.ls-line {
margin: 0;
font: 800 clamp(20px, 6vw, 30px)/1.2 -apple-system, "Segoe UI", sans-serif;
color: $color;
opacity: 0;
filter: blur(7px);
}
.ls-line--l { transform: translateX(-$sp-10); }
.ls-line--r { transform: translateX($sp-10); }
// 데모 루프: 홀수 줄은 왼쪽에서, 짝수 줄은 오른쪽에서 밀려 들어와 지그재그로 자리를 잡는다
// 한 겹: 각 줄이 blur(7px)→0 으로 초점이 맞으며 들어온다 — $easing(관성 lerp)과 같은 구간에서 수렴
@keyframes ls-in-l {
0% { opacity: 0; transform: translateX(-$sp-10); filter: blur(7px); }
25%, 80% { opacity: 1; transform: none; filter: blur(0); }
100% { opacity: 0; transform: translateX(-$sp-10); filter: blur(7px); }
}
@keyframes ls-in-r {
0% { opacity: 0; transform: translateX($sp-10); filter: blur(7px); }
25%, 80% { opacity: 1; transform: none; filter: blur(0); }
100% { opacity: 0; transform: translateX($sp-10); filter: blur(7px); }
}
.ls-block.is-demo .ls-line--l { animation: ls-in-l $duration $easing infinite; }
.ls-block.is-demo .ls-line--r { animation: ls-in-r $duration $easing infinite; animation-delay: 160ms; }
@media (prefers-reduced-motion: reduce) {
.ls-line,
.ls-block.is-demo .ls-line {
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: #ffffff;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.ls-block {
display: grid;
gap: 4px;
text-align: center;
}
.ls-line {
margin: 0;
font: 800 clamp(20px, 6vw, 30px)/1.2 -apple-system, "Segoe UI", sans-serif;
color: #2f6df6;
opacity: 0;
filter: blur(7px);
}
.ls-line--l {
transform: translateX(-40px);
}
.ls-line--r {
transform: translateX(40px);
}
@keyframes ls-in-l {
0% {
opacity: 0;
transform: translateX(-40px);
filter: blur(7px);
}
25%, 80% {
opacity: 1;
transform: none;
filter: blur(0);
}
100% {
opacity: 0;
transform: translateX(-40px);
filter: blur(7px);
}
}
@keyframes ls-in-r {
0% {
opacity: 0;
transform: translateX(40px);
filter: blur(7px);
}
25%, 80% {
opacity: 1;
transform: none;
filter: blur(0);
}
100% {
opacity: 0;
transform: translateX(40px);
filter: blur(7px);
}
}
.ls-block.is-demo .ls-line--l {
animation: ls-in-l 2s 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) infinite;
}
.ls-block.is-demo .ls-line--r {
animation: ls-in-r 2s 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) infinite;
animation-delay: 160ms;
}
@media (prefers-reduced-motion: reduce) {
.ls-line,
.ls-block.is-demo .ls-line {
animation: none !important;
opacity: 1 !important;
transform: none !important;
filter: none !important;
}
}import { CSSProperties, useEffect, useRef, useState } from "react";
import styles from "./LineSlideAlternate.module.scss";
export interface LineSlideAlternateProps {
lines?: string[];
duration?: string;
easing?: string;
stagger?: string;
}
// 실사용: 뷰포트에 들어오면 홀수 줄은 왼쪽, 짝수 줄은 오른쪽에서 한 번씩 밀려 들어온다.
export default function LineSlideAlternate({
lines = ["DESIGN WITH", "INTENTION"],
duration = "550ms",
easing = "cubic-bezier(.2, .8, .2, 1)",
stagger = "120ms",
}: LineSlideAlternateProps) {
const ref = useRef<HTMLDivElement>(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 (
<div className={styles.block} style={style} ref={ref}>
{lines.map((line, i) => (
<p
key={line}
className={`${styles.line} ${i % 2 === 0 ? styles.fromLeft : styles.fromRight} ${inView ? styles.in : ""}`}
style={{ transitionDelay: inView ? `calc(${stagger} * ${i})` : undefined }}
>
{line}
</p>
))}
</div>
);
}04 줄마다 엇갈려 슬라이드 — 측정 누적면적 7.392% · 움직인 프레임 12/23GODRICH 원작 · zip 에 SCSS·React 포함 · CSS 텍스트 애니메이션 9종 — 등장·강조 모음
이 데모가 속한 글
CSS 텍스트 애니메이션 9종 — 등장·강조 모음CSS 텍스트 애니메이션은 제목이나 문장이 화면에 나타나거나 강조될 때 함께 움직이는 효과로, 코드를 몰라도 파일을 그대로 붙이면 바로 쓸 수 있습니다. 제목 하나로 눈길 끄는 그 짧은 순간을 만드는 아홉 가지 방법 이 글의 데모 전부 보기


