시네마틱 GSAP Lenis 모션 시스템
사용 시기
- 사이트에 개별 애니메이션이 아닌 완전한 프리미엄 모션 언어가 필요할 때
- 부드러운 스크롤, 스크롤 리빌, 고정 장면, 패럴랙스, 호버 모션, 커서 동작이 유기적으로 연결되어야 할 때
- 목표 분위기가 럭셔리 에디토리얼, Apple 수준의 완성도, 크리에이티브 스튜디오 포트폴리오, 몰입형 시네마틱 스토리텔링일 때
- 스택이 GSAP, ScrollTrigger, Lenis를 사용할 수 있을 때
모션 취향
- 부드럽고, 우아하며, 약간 지연되고, 의도적이어야 함
- 지연된(staggered) 모션은 읽기 순서를 안내해야 함
- 레이어드 움직임은 인터페이스를 복잡해 보이지 않게 하면서 깊이를 만들어야 함
- ScrollTrigger는 장면이 뷰포트에 들어올 때 시작되어야 하며, 미세한 스크롤마다 반응해서는 안 됨
- 강렬함보다는 미묘함을 선호
피해야 할 것:
- 바운스, 탄성, 스프링, 장난스러운 모션
- 빠르고 갑작스러운 전환
- 큰 규모의 점프
- 과도한 애니메이션 UI
- 화려한 게임 스타일 효과
기본 토큰
- 이징:
power3.out,power4.out,expo.out - 스크롤 스크럽:
scrub: 0.8~1.4(시네마틱 지연) - 리빌:
0.75s~1.1s - 호버:
0.35s~0.6s - 커서 지연:
0.25s~0.45s - 텍스트 스태거: 단어
0.035s~0.07s, 줄0.08s~0.14s - 카드 스태거:
0.06s~0.1s - 리빌 트리거:
start: "top 82%" - 핀 핸드오프:
anticipatePin: 1
설정
설치:
npm i gsap lenis
DOM이 존재한 후 한 번 초기화합니다. Lenis는 GSAP 티커를 통해 RAF를 구동하므로 ScrollTrigger와 부드러운 스크롤이 동기화됩니다.
import Lenis from "lenis";
import "lenis/dist/lenis.css";
import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
gsap.registerPlugin(ScrollTrigger);
gsap.defaults({ ease: "power3.out", duration: 0.85 });
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
let lenis;
if (!reduceMotion) {
lenis = new Lenis({
lerp: 0.08,
smoothWheel: true,
wheelMultiplier: 0.9,
anchors: true,
});
lenis.on("scroll", ScrollTrigger.update);
gsap.ticker.add((time) => {
lenis.raf(time * 1000);
});
gsap.ticker.lagSmoothing(0);
}
window.addEventListener("load", () => {
ScrollTrigger.refresh();
});
마크업 API
작은 data 속성을 사용하여 모션 시스템을 페이지 전체에서 재사용할 수 있도록 합니다.
<h1 data-motion-text="lines">시네마틱한 절제가 있는 디지털 제품</h1>
<p data-motion-text="words">모든 상호작용은 의도적으로 느껴져야 합니다.</p>
<section data-reveal-group>
<article data-reveal="fade-up" data-reveal-item>...</article>
<article data-reveal="fade-up" data-reveal-item>...</article>
</section>
<figure data-image-reveal data-parallax-section>
<img data-parallax-image src="/studio.jpg" alt="">
</figure>
<a data-magnetic data-cursor-label="탐색" href="/work">탐색</a>
<div data-cursor><span data-cursor-label></span></div>
CSS 기초
html.has-motion [data-motion-text],
html.has-motion [data-reveal],
html.has-motion [data-reveal-item],
html.has-motion [data-image-reveal] {
visibility: hidden;
}
.motion-line-mask,
.motion-word-mask {
display: inline-block;
overflow: hidden;
vertical-align: top;
}
.motion-line,
.motion-word {
display: inline-block;
will-change: transform, opacity, filter;
}
[data-image-reveal] {
overflow: hidden;
}
[data-parallax-image] {
display: block;
width: 100%;
height: 115%;
object-fit: cover;
will-change: transform;
}
[data-cursor] {
position: fixed;
left: 0;
top: 0;
z-index: 9999;
pointer-events: none;
mix-blend-mode: difference;
transform: translate3d(-50%, -50%, 0);
will-change: transform;
}
@media (prefers-reduced-motion: reduce), (pointer: coarse) {
[data-cursor] {
display: none;
}
}
지연된 텍스트 리빌
프리미엄 텍스트를 위해 마스킹된 컨테이너를 사용합니다. 정확한 줄바꿈이 중요할 때는 수동 줄 래퍼를 선호합니다. 유연한 반응형 텍스트를 위해 단어 분할을 사용합니다.
document.documentElement.classList.add("has-motion");
function splitWords(element) {
if (element.dataset.motionSplit === "true") return;
const text = element.textContent || "";
const parts = text.split(/(\s+)/);
element.textContent = "";
element.setAttribute("aria-label", text.trim());
let index = 0;
parts.forEach((part) => {
if (!part.trim()) {
element.appendChild(document.createTextNode(part));
return;
}
const mask = document.createElement("span");
const word = document.createElement("span");
mask.className = "motion-word-mask";
mask.setAttribute("aria-hidden", "true");
word.className = "motion-word";
word.textContent = part;
word.style.setProperty("--word-index", index);
mask.appendChild(word);
element.appendChild(mask);
index += 1;
});
element.dataset.motionSplit = "true";
}
function splitLines(element) {
if (element.dataset.motionLineSplit === "true") return;
if (element.querySelector(".motion-line")) return;
const text = (element.textContent || "").trim();
const lines = text.split(/\n+/).map((line) => line.trim()).filter(Boolean);
if (lines.length < 2) return;
element.textContent = "";
element.setAttribute("aria-label", text);
lines.forEach((line) => {
const mask = document.createElement("span");
const inner = document.createElement("span");
mask.className = "motion-line-mask";
mask.setAttribute("aria-hidden", "true");
inner.className = "motion-line";
inner.textContent = line;
mask.appendChild(inner);
element.appendChild(mask);
element.appendChild(document.createTextNode(" "));
});
element.dataset.motionLineSplit = "true";
}
function initTextReveals() {
if (reduceMotion) {
gsap.set("[data-motion-text]", { autoAlpha: 1, clearProps: "all" });
return;
}
gsap.utils.toArray("[data-motion-text='words']").forEach((element) => {
splitWords(element);
const words = element.querySelectorAll(".motion-word");
gsap.set(element, { autoAlpha: 1 });
gsap.fromTo(
words,
{ yPercent: 110, autoAlpha: 0, filter: "blur(8px)" },
{
yPercent: 0,
autoAlpha: 1,
filter: "blur(0px)",
duration: 0.9,
ease: "power4.out",
stagger: 0.055,
scrollTrigger: {
trigger: element,
start: "top 82%",
once: true,
},
}
);
});
gsap.utils.toArray("[data-motion-text='lines']").forEach((element) => {
splitLines(element);
const lines = element.querySelectorAll(".motion-line");
const targets = lines.length ? lines : element.children;
gsap.set(element, { autoAlpha: 1 });
gsap.fromTo(
targets,
{ yPercent: 100, autoAlpha: 0, filter: "blur(8px)" },
{
yPercent: 0,
autoAlpha: 1,
filter: "blur(0px)",
duration: 1,
ease: "power4.out",
stagger: 0.11,
scrollTrigger: {
trigger: element,
start: "top 84%",
once: true,
},
}
);
});
}
정확한 줄바꿈이 중요할 때의 줄 마크업:
<h2 data-motion-text="lines">
<span class="motion-line-mask"><span class="motion-line">시네마틱 모션</span></span>
<span class="motion-line-mask"><span class="motion-line">에디토리얼한 절제로</span></span>
</h2>
스크롤 리빌
작은 리빌 프리셋 맵을 만듭니다. autoAlpha, 변형, 약간의 블러를 사용합니다. 큰 요소에는 블러를 드물게 사용합니다.
const revealPresets = {
"fade-up": { from: { y: 32, autoAlpha: 0 }, to: { y: 0, autoAlpha: 1 } },
"blur-in": { from: { y: 18, autoAlpha: 0, filter: "blur(10px)" }, to: { y: 0, autoAlpha: 1, filter: "blur(0px)" } },
"scale": { from: { scale: 0.96, autoAlpha: 0 }, to: { scale: 1, autoAlpha: 1 } },
"slide-left": { from: { x: 48, autoAlpha: 0 }, to: { x: 0, autoAlpha: 1 } },
"slide-right": { from: { x: -48, autoAlpha: 0 }, to: { x: 0, autoAlpha: 1 } },
};
function initScrollReveals() {
if (reduceMotion) {
gsap.set("[data-reveal], [data-reveal-item]", { autoAlpha: 1, clearProps: "all" });
return;
}
gsap.utils.toArray("[data-reveal-group]").forEach((group) => {
const items = group.querySelectorAll("[data-reveal-item]");
gsap.set(group, { autoAlpha: 1 });
gsap.fromTo(
items,
{ y: 36, autoAlpha: 0, filter: "blur(8px)" },
{
y: 0,
autoAlpha: 1,
filter: "blur(0px)",
duration: 0.95,
ease: "power4.out",
stagger: 0.075,
scrollTrigger: {
trigger: group,
start: "top 82%",
once: true,
},
}
);
});
gsap.utils.toArray("[data-reveal]:not([data-reveal-item])").forEach((element) => {
const preset = revealPresets[element.dataset.reveal] || revealPresets["fade-up"];
gsap.set(element, { autoAlpha: 1 });
gsap.fromTo(element, preset.from, {
...preset.to,
duration: 0.9,
ease: "power4.out",
delay: Number(element.dataset.revealDelay || 0),
scrollTrigger: {
trigger: element,
start: "top 84%",
once: true,
},
});
});
}
클립 이미지 리빌
function initImageReveals() {
if (reduceMotion) {
gsap.set("[data-image-reveal]", { autoAlpha: 1, clipPath: "none" });
return;
}
gsap.utils.toArray("[data-image-reveal]").forEach((figure) => {
const image = figure.querySelector("img");
gsap.set(figure, { autoAlpha: 1 });
const tl = gsap.timeline({
scrollTrigger: {
trigger: figure,
start: "top 82%",
once: true,
},
});
tl.fromTo(
figure,
{ clipPath: "inset(0 0 100% 0)" },
{ clipPath: "inset(0 0 0% 0)", duration: 1.1, ease: "power4.out" }
).fromTo(
image,
{ scale: 1.08, autoAlpha: 0.75 },
{ scale: 1, autoAlpha: 1, duration: 1.2, ease: "power4.out" },
0
);
});
}
패럴랙스 모션
극적인 움직임 대신 속도 차이를 사용합니다. 배경은 콘텐츠보다 느리게 움직입니다. 전경 악센트는 약간 더 빠르게 움직입니다.
function initParallax() {
if (reduceMotion) return;
gsap.utils.toArray("[data-parallax-image], [data-parallax-layer]").forEach((layer) => {
const speed = Number(layer.dataset.parallaxSpeed || 0.18);
const section = layer.closest("[data-parallax-section]") || layer;
gsap.to(layer, {
y: () => window.innerHeight * speed * -1,
ease: "none",
scrollTrigger: {
trigger: section,
start: "top bottom",
end: "bottom top",
scrub: 1.2,
invalidateOnRefresh: true,
},
});
});
}
고정 스크롤 섹션
스토리 순간에만 고정된 섹션을 사용합니다. 스크롤 동기화 움직임을 선형으로 유지한 다음, 장면 내에 이징된 리빌 트윈을 레이어합니다.
function initHorizontalGalleries() {
if (reduceMotion) return;
gsap.utils.toArray("[data-horizontal-gallery]").forEach((section) => {
const track = section.querySelector("[data-horizontal-track]");
if (!track) return;
gsap.to(track, {
x: () => -(track.scrollWidth - window.innerWidth),
ease: "none",
scrollTrigger: {
trigger: section,
start: "top top",
end: () => `+=${track.scrollWidth}`,
scrub: 1,
pin: true,
anticipatePin: 1,
invalidateOnRefresh: true,
},
});
});
}
고정 스토리텔링 패턴:
function initStoryScenes() {
if (reduceMotion) return;
gsap.utils.toArray("[data-story-scene]").forEach((scene) => {
const panels = scene.querySelectorAll("[data-story-panel]");
gsap.timeline({
scrollTrigger: {
trigger: scene,
start: "top top",
end: () => `+=${panels.length * window.innerHeight}`,
scrub: 1.1,
pin: true,
anticipatePin: 1,
},
})
.to(panels, { yPercent: -100 * (panels.length - 1), ease: "none" })
.to(scene.querySelectorAll("[data-story-depth]"), { yPercent: -16, ease: "none" }, 0);
});
}
프리미엄 호버 인터랙션
마그네틱 모션에 GSAP quickTo를 사용하여 호버가 모든 이벤트에서 트윈을 다시 생성하지 않고 포인터를 따라가도록 합니다.
function initMagnetic() {
if (reduceMotion || window.matchMedia("(pointer: coarse)").matches) return;
gsap.utils.toArray("[data-magnetic]").forEach((element) => {
const strength = Number(element.dataset.magnetic || 0.18);
const xTo = gsap.quickTo(element, "x", { duration: 0.45, ease: "power3.out" });
const yTo = gsap.quickTo(element, "y", { duration: 0.45, ease: "power3.out" });
element.addEventListener("pointermove", (event) => {
const rect = element.getBoundingClientRect();
const x = (event.clientX - rect.left - rect.width / 2) * strength;
const y = (event.clientY - rect.top - rect.height / 2) * strength;
xTo(x);
yTo(y);
});
element.addEventListener("pointerleave", () => {
xTo(0);
yTo(0);
});
});
}
호버 레시피:
- 마그네틱 버튼:
x/y만 이동, 스케일을1.03미만으로 유지 - 마그네틱 카드:
rotateX/rotateY를4deg미만으로 추가 - 이미지 확대:
scale: 1에서1.06, 지속 시간0.7s, 이징power3.out - 그레이스케일에서 컬러로: 소형/중형 미디어에서만 필터 전환
- 애니메이션 화살표: 아이콘을
x: 0에서x: 6으로 이동, 중복 화살표 페이드 인 - 방향성 호버: 포인터 진입 방향 계산, 하지만 움직임을
16px미만으로 유지
커스텀 커서
장식용이 아닌 분위기 조성용 커서 추적기를 사용합니다. 터치 기기에서는 숨깁니다.
function initCursor() {
if (reduceMotion || window.matchMedia("(pointer: coarse)").matches) return;
const cursor = document.querySelector("[data-cursor]");
if (!cursor) return;
const label = cursor.querySelector("[data-cursor-label]");
const xTo = gsap.quickTo(cursor, "x", { duration: 0.35, ease: "power3.out" });
const yTo = gsap.quickTo(cursor, "y", { duration: 0.35, ease: "power3.out" });
document.addEventListener("pointermove", (event) => {
xTo(event.clientX);
yTo(event.clientY);
});
gsap.utils.toArray("[data-cursor-label]")
}
보너스: 더 많은 모션
눈에 덜 띄는 추가 효과:
function initCounters() {
if (reduceMotion) return;
gsap.utils.toArray("[data-count-to]").forEach((el) => {
gsap.from(el, {
innerText: 0,
duration: 2.2,
ease: "power3.out",
snap: { innerText: 1 },
scrollTrigger: { trigger: el, start: "top 80%", once: true },
});
});
}
function initTextDeform() {
if (reduceMotion) return;
gsap.utils.toArray("[data-deform]").forEach((el) => {
gsap.fromTo(
el,
{ scaleY: 0.6, filter: "blur(12px)", autoAlpha: 0 },
{
scaleY: 1,
filter: "blur(0px)",
autoAlpha: 1,
duration: 1.1,
ease: "power4.out",
scrollTrigger: { trigger: el, start: "top 84%", once: true },
}
);
});
}
접근성: 축소 모션 선호가 감지되면 모든 인터랙션이 조용해집니다.
