03Fade + slide utility
Defining just one `--animate-fade-slide` variable in `@theme` — no plugin — bundles opacity and translateY into a single keyframe, so a paragraph rises 16px into view with one utility class.
Best forHero paragraph reveals, section-title reveals
@keyframes fade-slidetranslateY+opacity400ms

<main class="stage">
<p class="lead is-demo">One line is all it takes<br>Tailwind animation</p>
</main>@use "../../../../site/static/demo-tokens" as *;
// ── 변수 3개 ──────────────────────────────────────────
$duration: 400ms;
$easing: ease-out;
$color: $subject-cream;
// ── 데모 무대 ──────────────────────────────────────────
@include stage($stage-orange);
.lead {
margin: 0;
max-width: min(300px, 88vw);
color: $color;
text-align: center;
font-weight: 700;
font-size: clamp(18px, 5.2vw, 24px);
line-height: 1.35;
font-family: inherit;
opacity: 0;
transform: translateY(16px);
}
// 데모: --animate-fade-slide 하나로 문단이 떠오르는 걸 2초마다 반복
.lead.is-demo {
animation: fade-slide-loop 2s $easing infinite;
}
@keyframes fade-slide-loop {
0% { opacity: 0; transform: translateY(16px); }
22% { opacity: 1; transform: translateY(0); }
82% { opacity: 1; transform: translateY(0); }
100% { opacity: 0; transform: translateY(16px); }
}
// 실사용: 한 번만
.lead.is-appear {
animation: fade-slide $duration $easing both;
}
@keyframes fade-slide {
from { opacity: 0; transform: translateY(16px); }
to { opacity: 1; transform: translateY(0); }
}
// ── 접근성 ──────────────────────────────────────────
@media (prefers-reduced-motion: reduce) {
.lead.is-demo, .lead.is-appear { animation: none; opacity: 1; transform: none; }
}html, body {
margin: 0;
overflow: hidden;
}
.stage {
box-sizing: border-box;
min-height: 100vh;
display: grid;
place-items: center;
margin: 0;
background: #ff4d1f;
font-family: -apple-system, "Segoe UI", "Noto Sans KR", sans-serif;
padding: clamp(8px, 4vw, 24px);
}
.lead {
margin: 0;
max-width: min(300px, 88vw);
color: #fff7e6;
text-align: center;
font-weight: 700;
font-size: clamp(18px, 5.2vw, 24px);
line-height: 1.35;
font-family: inherit;
opacity: 0;
transform: translateY(16px);
}
.lead.is-demo {
animation: fade-slide-loop 2s ease-out infinite;
}
@keyframes fade-slide-loop {
0% {
opacity: 0;
transform: translateY(16px);
}
22% {
opacity: 1;
transform: translateY(0);
}
82% {
opacity: 1;
transform: translateY(0);
}
100% {
opacity: 0;
transform: translateY(16px);
}
}
.lead.is-appear {
animation: fade-slide 400ms ease-out both;
}
@keyframes fade-slide {
from {
opacity: 0;
transform: translateY(16px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@media (prefers-reduced-motion: reduce) {
.lead.is-demo, .lead.is-appear {
animation: none;
opacity: 1;
transform: none;
}
}import type { CSSProperties } from "react";
import styles from "./FadeSlideLead.module.scss";
export type FadeSlideLeadProps = {
children?: string;
duration?: number;
easing?: string;
color?: string;
};
type Vars = CSSProperties & { "--duration"?: string; "--easing"?: string; "--color"?: string };
export default function FadeSlideLead({
children = "One line is all it takes",
duration = 400,
easing = "ease-out",
color = "#fff7e6",
}: FadeSlideLeadProps) {
const vars: Vars = { "--duration": `${duration}ms`, "--easing": easing, "--color": color };
return (
<p className={styles.lead} style={vars}>
{children}
</p>
);
}03 Fade + slide utility — Measured area 6.125% · moving frames 10/23Original by GODRICH · SCSS and React ship in the zip · 9 Tailwind v4 Animations — One Line, Copy-Paste
The post this demo lives in
9 Tailwind v4 Animations — One Line, Copy-PasteThese nine Tailwind v4 animations turn one utility class into a real keyframe, a hover state, or a reduced-motion guard, See all demos in this post


