모션·인터랙션 / GSAP / ScrollTrigger
Infinite looped panels
고정된 패널을 겹치며 스크롤 시작과 끝을 무한히 연결합니다.
미리보기 안의 버튼·입력·포인터로 모션을 확인하세요. 실행 방식은 아래 활용 메모를 참고하세요.
실행용 통합 HTML · 공식 GSAP 3.15.0
<!doctype html>
<!-- Archived from GSAP Demo Hub / infinite-looped-panels
Original editor: https://codepen.io/GreenSock/pen/VwbywPd
HTML/CSS/JS source panels are preserved separately. Runtime GSAP: 3.15.0 official distribution. -->
<html lang="en" class=""><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Infinite looped panels</title>
<link href='//fonts.googleapis.com/css?family=Signika+Negative:300,400,600' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://asset.wemashup.com/wp-content/uploads/wm-asset-library/gsap/shared/normalize-5.0.0.min.css">
<link rel="stylesheet" href="https://asset.wemashup.com/wp-content/uploads/wm-asset-library/gsap/shared/xxmzBrw.css">
<style>
</style></head><body>
<div class="description panel">
<h1>Layered pinning with infinite looping</h1>
<p>Use pinning to layer panels on top of each other as you scroll.</p>
<div class="scroll-down"><div class="arrow"></div></div>
</div>
<section class="panel green">
<h2 class="panel__number">1</h2>
</section>
<section class="panel">
<h2 class="panel__number">2</h2>
</section>
<section class="panel purple">
<h2 class="panel__number">3</h2>
</section>
<section class="panel">
<h2 class="panel__number">4</h2>
</section>
<section class="panel blue">
<h2 class="panel__number">5</h2>
</section>
<script src="https://asset.wemashup.com/wp-content/uploads/wm-asset-library/gsap/shared/gsap-3.15.0-gsap.min.js"></script>
<script src="https://asset.wemashup.com/wp-content/uploads/wm-asset-library/gsap/shared/gsap-3.15.0-ScrollTrigger.min.js"></script>
<script src="https://asset.wemashup.com/wp-content/uploads/wm-asset-library/gsap/shared/7ba936b34824fefdccfe2c6d9f0b740b.js"></script>
<script>
gsap.registerPlugin(ScrollTrigger);
let panels = gsap.utils.toArray(".panel"),
copy = panels[0].cloneNode(true);
panels[0].parentNode.appendChild(copy); // copy the first panel to the end (for seamless looping)
panels.forEach((panel, i) => {
ScrollTrigger.create({
trigger: panel,
start: "top top",
pin: true,
pinSpacing: false
});
});
let maxScroll;
let pageScrollTrigger = ScrollTrigger.create({ // snap whole page to the closest section!
// normally we'd just do snap: 1 / panels.length but we'll use a function-based value so that we can handle the very start and end values in a special way to prevent looping on the snap
snap(value) {
let snappedValue = gsap.utils.snap(1 / panels.length, value);
if (snappedValue <= 0) { // don't let it go all the way back to exactly 0 or it'll wrap. Keep it a bit more than 1px from the top.
return 1.05 / maxScroll;
} else if (snappedValue >= 1) { // don't let it go all the way to the end or it'll wrap. Keep it a bit more than 1px from the bottom.
return maxScroll / (maxScroll + 1.05);
}
return snappedValue;
}
});
function onResize() {
maxScroll = ScrollTrigger.maxScroll(window) - 1;
}
onResize();
window.addEventListener("resize", onResize);
// make sure we use a non-passive event listener so that we can preventDefault() on the scroll if it's at the very top or bottom
window.addEventListener("scroll", e => {
let scroll = pageScrollTrigger.scroll()
if (scroll > maxScroll) {
pageScrollTrigger.scroll(1);
e.preventDefault();
} else if (scroll < 1) {
pageScrollTrigger.scroll(maxScroll - 1);
e.preventDefault();
}
}, {passive: false});
</script>
</body></html>
원본 HTML
<div class="description panel">
<h1>Layered pinning with infinite looping</h1>
<p>Use pinning to layer panels on top of each other as you scroll.</p>
<div class="scroll-down"><div class="arrow"></div></div>
</div>
<section class="panel green">
<h2 class="panel__number">1</h2>
</section>
<section class="panel">
<h2 class="panel__number">2</h2>
</section>
<section class="panel purple">
<h2 class="panel__number">3</h2>
</section>
<section class="panel">
<h2 class="panel__number">4</h2>
</section>
<section class="panel blue">
<h2 class="panel__number">5</h2>
</section>
원본 CSS
원본 JavaScript
gsap.registerPlugin(ScrollTrigger);
let panels = gsap.utils.toArray(".panel"),
copy = panels[0].cloneNode(true);
panels[0].parentNode.appendChild(copy); // copy the first panel to the end (for seamless looping)
panels.forEach((panel, i) => {
ScrollTrigger.create({
trigger: panel,
start: "top top",
pin: true,
pinSpacing: false
});
});
let maxScroll;
let pageScrollTrigger = ScrollTrigger.create({ // snap whole page to the closest section!
// normally we'd just do snap: 1 / panels.length but we'll use a function-based value so that we can handle the very start and end values in a special way to prevent looping on the snap
snap(value) {
let snappedValue = gsap.utils.snap(1 / panels.length, value);
if (snappedValue <= 0) { // don't let it go all the way back to exactly 0 or it'll wrap. Keep it a bit more than 1px from the top.
return 1.05 / maxScroll;
} else if (snappedValue >= 1) { // don't let it go all the way to the end or it'll wrap. Keep it a bit more than 1px from the bottom.
return maxScroll / (maxScroll + 1.05);
}
return snappedValue;
}
});
function onResize() {
maxScroll = ScrollTrigger.maxScroll(window) - 1;
}
onResize();
window.addEventListener("resize", onResize);
// make sure we use a non-passive event listener so that we can preventDefault() on the scroll if it's at the very top or bottom
window.addEventListener("scroll", e => {
let scroll = pageScrollTrigger.scroll()
if (scroll > maxScroll) {
pageScrollTrigger.scroll(1);
e.preventDefault();
} else if (scroll < 1) {
pageScrollTrigger.scroll(maxScroll - 1);
e.preventDefault();
}
}, {passive: false});
검증·권리 정보
- 실행 검증
- 데스크톱 실행 확인
- 검증 수준
- 샘플 실행
- 권리 확인
- 확인 필요
고정된 패널을 겹치며 스크롤 시작과 끝을 무한히 연결합니다.
Chromium 153 · 데스크톱 1280×900 · 격리 iframe에서 스크롤 입력과 화면 변화 확인. 모바일·프로젝트 적용은 미검증.
원본 패널과 통합 실행 파일은 분리해 보관했습니다. 원본의 구형 전용 라이브러리 대신 통합 실행은 공식 GSAP 3.15.0을 사용합니다.
보관·활용 메모
GSAP Demo Hub의 공개 예제입니다. 원본 HTML·CSS·JavaScript와 설정, 시연 파일을 함께 보관했습니다. 통합 HTML은 공통 스타일과 실행 의존성을 연결한 파일이며 SCSS는 원본 컴파일 결과를 사용합니다.
구형 CodePen 전용 의존성을 그대로 배포하지 않고, 통합 실행에는 공식 GSAP 3.15.0을 연결했습니다. 원본 패널과 원본 설정은 ZIP에 별도로 보존되어 있습니다. 예제의 이미지·폰트 등 외부 소재 요청은 유지됩니다.
보관일 2026-10-26 · 원본 코드·작성자·설정 정보를 보존했습니다. 실제 프로젝트에서 코드와 이미지·폰트의 사용 조건을 확인하세요.