미리보기 안에서 스크롤하거나 마우스를 움직여 모션을 확인하세요.
실행용 통합 HTML · 공식 GSAP 3.15.0
<!doctype html>
<!-- Archived from GSAP Demo Hub / smooth-scrolling
Original editor: https://codepen.io/GreenSock/pen/KKXZOyZ
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>Smooth Scrolling</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://asset.wemashup.com/wp-content/uploads/wm-asset-library/gsap/shared/xxmzBrw.css">
<style>
body {
background-color: var(--color-just-black);
overscroll-behavior: none;
margin: 0;
padding: 0;
overflow-x: hidden;
}
.header {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
padding-top: 2.5rem;
}
#smooth-content {
overflow: visible;
width: 100%;
/* set a height because the contents are position: absolute, thus natively there's no height */
height: 4000px;
background-image: linear-gradient(
rgba(255, 255, 255, 0.07) 2px,
transparent 2px
),
linear-gradient(90deg, rgba(255, 255, 255, 0.07) 2px, transparent 2px),
linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
}
button {
position: relative;
margin-top: 1rem;
}
heading-l {
margin-top: 2rem;
}
.box,
.shape {
width: 100px;
height: 100px;
position: absolute;
left: 50%;
transform: translateX(-50%);
z-index: 100;
line-height: 100px;
text-align: center;
will-change: transform;
}
.box.active {
outline: 2px var(--color-surface-white);
}
.box-a {
top: 400px;
}
.box-b {
top: 900px;
}
.shape {
top: 1300px;
will-change: transform;
}
.line {
visibility: hidden;
width: 2px;
height: 4000px;
position: absolute;
left: 400px;
top: 0px;
background-color: #777;
}
footer {
position: fixed;
right: 0px;
bottom: 0px;
padding: 6px 10px 10px 12px;
border-top-left-radius: 26px;
z-index: 100;
background-color: rgba(0, 0, 0, 0.5);
}
.end {
position: absolute;
/* bottom: 0; */
top: 2400px;
transform: translateY(-100%);
font-size: 30px;
color: white;
}
</style></head><body>
<div id="smooth-wrapper">
<div id="smooth-content">
<header class="header">
<h1 class="heading-l heading-scroll">ScrollSmoother</h1>
<button class="button">Jump to shape</button>
</header>
<div class="box box-a gradient-pink" data-speed="clamp(0.5)">a</div>
<div class="box box-b gradient-purple" data-speed="clamp(0.8)">b</div>
<img class="shape" data-speed="1.5" src="https://assets.codepen.io/16327/2D-keyframe-2.png" alt="" />
<div class="line"></div>
</div>
</div>
<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-ScrollSmoother.min.js"></script>
<script src="https://asset.wemashup.com/wp-content/uploads/wm-asset-library/gsap/shared/gsap-3.15.0-ScrollToPlugin.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>
gsap.registerPlugin(ScrollTrigger, ScrollSmoother);
// create the smooth scroller FIRST!
let smoother = ScrollSmoother.create({
smooth: 2,
effects: true
});
// pin shape when it reaches the center of the viewport, for 300px
ScrollTrigger.create({
trigger: ".shape",
pin: true,
start: "center center",
end: "+=300"
});
document.querySelector("button").addEventListener("click", (e) => {
// scroll to the spot where the shape is in the center.
// parameters: element, smooth, position
smoother.scrollTo(".shape", true, "center center");
// or you could animate the scrollTop:
// gsap.to(smoother, {
// scrollTop: smoother.offset(".shape", "center center"),
// duration: 1
// });
});
</script>
</body></html>
원본 HTML
<div id="smooth-wrapper">
<div id="smooth-content">
<header class="header">
<h1 class="heading-l heading-scroll">ScrollSmoother</h1>
<button class="button">Jump to shape</button>
</header>
<div class="box box-a gradient-pink" data-speed="clamp(0.5)">a</div>
<div class="box box-b gradient-purple" data-speed="clamp(0.8)">b</div>
<img class="shape" data-speed="1.5" src="https://assets.codepen.io/16327/2D-keyframe-2.png" alt="" />
<div class="line"></div>
</div>
</div>원본 CSS
body {
background-color: var(--color-just-black);
overscroll-behavior: none;
margin: 0;
padding: 0;
overflow-x: hidden;
}
.header {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
padding-top: 2.5rem;
}
#smooth-content {
overflow: visible;
width: 100%;
/* set a height because the contents are position: absolute, thus natively there's no height */
height: 4000px;
background-image: linear-gradient(
rgba(255, 255, 255, 0.07) 2px,
transparent 2px
),
linear-gradient(90deg, rgba(255, 255, 255, 0.07) 2px, transparent 2px),
linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
}
button {
position: relative;
margin-top: 1rem;
}
heading-l {
margin-top: 2rem;
}
.box,
.shape {
width: 100px;
height: 100px;
position: absolute;
left: 50%;
transform: translateX(-50%);
z-index: 100;
line-height: 100px;
text-align: center;
will-change: transform;
}
.box.active {
outline: 2px var(--color-surface-white);
}
.box-a {
top: 400px;
}
.box-b {
top: 900px;
}
.shape {
top: 1300px;
will-change: transform;
}
.line {
visibility: hidden;
width: 2px;
height: 4000px;
position: absolute;
left: 400px;
top: 0px;
background-color: #777;
}
footer {
position: fixed;
right: 0px;
bottom: 0px;
padding: 6px 10px 10px 12px;
border-top-left-radius: 26px;
z-index: 100;
background-color: rgba(0, 0, 0, 0.5);
}
.end {
position: absolute;
/* bottom: 0; */
top: 2400px;
transform: translateY(-100%);
font-size: 30px;
color: white;
}
원본 JavaScript
gsap.registerPlugin(ScrollTrigger, ScrollSmoother);
// create the smooth scroller FIRST!
let smoother = ScrollSmoother.create({
smooth: 2,
effects: true
});
// pin shape when it reaches the center of the viewport, for 300px
ScrollTrigger.create({
trigger: ".shape",
pin: true,
start: "center center",
end: "+=300"
});
document.querySelector("button").addEventListener("click", (e) => {
// scroll to the spot where the shape is in the center.
// parameters: element, smooth, position
smoother.scrollTo(".shape", true, "center center");
// or you could animate the scrollTop:
// gsap.to(smoother, {
// scrollTop: smoother.offset(".shape", "center center"),
// duration: 1
// });
});
보관·활용 메모
GSAP Demo Hub의 공개 예제입니다. 원본 HTML·CSS·JavaScript와 설정, 시연 파일을 함께 보관했습니다. 통합 HTML은 공통 스타일과 실행 의존성을 연결한 파일이며 SCSS는 원본 컴파일 결과를 사용합니다.
구형 CodePen 전용 의존성을 그대로 배포하지 않고, 통합 실행에는 공식 GSAP 3.15.0을 연결했습니다. 원본 패널과 원본 설정은 ZIP에 별도로 보존되어 있습니다. 예제의 이미지·폰트 등 외부 소재 요청은 유지됩니다.
보관일 2026-10-26 · 원본 코드·작성자·설정 정보를 보존했습니다. 실제 프로젝트에서 코드와 이미지·폰트의 사용 조건을 확인하세요.