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


