GSAP 사례 연구
Link To Scroll Progress
스크롤 · MIT (local companion); GSAP Standard No Charge License (runtime)
갤러리 안에서는 화면을 벗어나거나 움직임을 멈추면 예제도 닫힙니다. 다시 재생할 때는 처음부터 시작해요.
저장한 HTML에서는 갤러리의 재생 설정이 적용되지 않아요.
SOURCE FILES
독립 예제 코드 읽기
사례의 구도나 문서의 원리를 바탕으로 새로 만든 예제입니다. 아래 코드를 복사해 직접 응용할 수 있습니다. 실행 HTML에는 미리보기를 위한 실행 환경이 들어 있습니다.
vendor/gsap-previews/sources/gsap-84222c3ca295/source-input.js
gsap.to('.flair', {
rotation: 360,
scrollTrigger: {
trigger: '#trigger',
start: 'top center',
end: 'bottom center',
scrub: true, // or a number like 0.5 or 1 to smooth the scrub.
},
})vendor/gsap-previews/sources/gsap-84222c3ca295/index.html실행 안내·자료
<main class="study"><p class="study-label">공식 문서 기반 · 독립 예제</p><header><h2>스크롤 위치가 정하는 회전</h2><p>구간의 위쪽과 아래쪽이 프리뷰 중앙을 지나는 사이에 도형이 한 바퀴 회전합니다.</p></header><div class="lead">아래로 스크롤</div><section id="trigger"><span class="edge edge-start">구간 시작</span><div class="flair"><svg viewBox="0 0 160 160" role="img" aria-label="움직이는 도형"><defs><linearGradient id="orb-g" x2="1" y2="1"><stop stop-color="#94efd2"/><stop offset="1" stop-color="#8980ff"/></linearGradient></defs><path d="m80 8 22 44 49 7-35 34 8 49-44-23-44 23 8-49L9 59l49-7Z" fill="url(#orb-g)"/></svg></div><span class="edge edge-end">구간 끝</span></section><div class="lead">역방향으로도 확인하세요</div></main>함께 쓰는 파일 3개 보기
vendor/gsap-previews/sources/gsap-84222c3ca295/style.css실행 안내·자료
*{box-sizing:border-box}body{background:#111522;color:#f5f2eb;font-family:system-ui,sans-serif;margin:0}button{font:inherit}.study{margin:0 auto;max-width:1100px;min-height:100vh;padding:clamp(20px,4vw,42px)}.study-label{color:#95efd2;font-size:12px;letter-spacing:.08em;margin:0 0 24px}header h2{font-size:clamp(24px,4vw,40px);letter-spacing:-.04em;margin:0 0 12px}header p{color:#aeb7c9;line-height:1.6;margin:0 0 24px;max-width:62ch}.controls{display:flex;flex-wrap:wrap;gap:8px;margin:20px 0}button{background:#26314b;border:1px solid #617394;border-radius:9px;color:#f5f2eb;cursor:pointer;padding:9px 14px}button:hover{background:#334261}button:focus-visible{outline:3px solid #95efd2;outline-offset:3px}button:disabled{cursor:default;opacity:.45}.stage{align-items:center;background:radial-gradient(ellipse at top,#243253,#141c2d);border:1px solid #3d4c68;border-radius:20px;display:flex;justify-content:center;min-height:220px;overflow:hidden;position:relative}.note{color:#aeb7c9;font-size:13px;line-height:1.5}.readout{color:#95efd2;font-family:ui-monospace,monospace;font-size:13px;min-height:2em}.stage svg{display:block;max-width:100%}code{font-family:ui-monospace,monospace}button[aria-pressed="true"]{background:#95efd2;color:#111522}
.study{padding:20px}.study-label{margin-bottom:12px}header h2{font-size:clamp(22px,4vw,32px)}header p{font-size:14px;margin-bottom:12px}.lead{align-items:center;color:#aeb7c9;display:flex;height:45vh;justify-content:center}.lead:first-of-type{height:24px}#trigger{border:1px solid #3d4c68;border-radius:20px;height:160vh;position:relative}.flair{height:160px;margin:0 auto;position:sticky;top:calc(50vh - 80px);width:160px}.edge{color:#95efd2;font-size:13px;left:20px;position:absolute}.edge-start{top:16px}.edge-end{bottom:16px}vendor/gsap-previews/sources/gsap-84222c3ca295/script.js실행 안내·자료
gsap.registerPlugin(ScrollTrigger);
gsap.to('.flair', {
rotation: 360,
scrollTrigger: {
trigger: '#trigger',
start: 'top center',
end: 'bottom center',
scrub: true, // or a number like 0.5 or 1 to smooth the scrub.
},
})LICENSE실행 안내·자료
Locally authored companion HTML/CSS/control wiring: MIT License.
Copyright (c) 2026 StyleGallery contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The separately retained official documentation excerpt is source input, not a recovered CodePen source set; this local MIT notice does not assign a new license to that excerpt.
GSAP 3.15.0: Copyright 2026, GreenSock. All rights reserved. Subject to https://gsap.com/standard-license. Original library notices are preserved.
BEHIND THE EXAMPLE
이 장면을 만드는 원리
현재 스크롤 구간과 회전 진행률
현재 위치에서 표현 상태를 도출하고 왕복과 중간 진입을 검증합니다.
- 이 예제에서는
- 공식 코드는 #trigger의 top center부터 bottom center까지 scrub:true로 회전을 연결합니다. 동반 예제의 긴 구간과 sticky 도형은 새로 만든 관찰 표면입니다. 문서에는 ease:none이 없으므로 회전 각도가 스크롤 거리와 일정한 비율이라고 추가로 주장하지 않습니다.
코드와 함께 확인하기
코드에서 찾기
start: 'top center'source-input.js구간 위쪽이 프리뷰 중앙에 도달하는 시작 조건입니다.
scrub: truesource-input.js시간 기반 진입 효과가 아니라 스크롤의 진행에 연결합니다.
직접 해보기
구간 중간을 아래·위 방향에서 각각 방문합니다.
살펴볼 변화같은 위치에서 같은 회전 상태가 되는지 확인합니다.
중간에서 스크롤을 멈춥니다.
살펴볼 변화문서가 정한 진행 상태에 머무르는지 확인합니다.
