GSAP 원본
Stagger items in on scroll
스크롤 · MIT (public Pen panels); GSAP Standard No Charge License
갤러리 안에서는 화면을 벗어나거나 움직임을 멈추면 예제도 닫힙니다. 다시 재생할 때는 처음부터 시작해요.
저장한 HTML에서는 갤러리의 재생 설정이 적용되지 않아요.
SOURCE FILES
원본 코드 읽기
수집한 원본 소스와 실행 안내를 함께 제공합니다. 실행 HTML에는 미리보기를 위한 실행 환경이 들어 있습니다.
vendor/gsap-previews/sources/gsap-62087cc4c25f/index.html
<div class="header">
<h1>ScrollTrigger.batch()</h1>
<p>
Easily create a staggered animation of all the elements that enter the viewport around the same time with batch().
</p>
</div>
<div class="container">
<img class="image" src="https://assets.codepen.io/16327/quentin.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/planetono.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/sanrita.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/anima.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/giulio.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/lando.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/glenn.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/fantik.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/romei.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ironhill.jpeg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/inkwell.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/monolith.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/phantom.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ribbit.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/aurel.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/aether.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/cashapp.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/osmo.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/pantheon.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ponpon.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/quentin.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/planetono.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/sanrita.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/anima.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/giulio.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/lando.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/glenn.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/fantik.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/romei.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ironhill.jpeg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/inkwell.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/monolith.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/phantom.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ribbit.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/aurel.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/aether.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/cashapp.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/osmo.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/pantheon.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ponpon.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/quentin.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/planetono.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/sanrita.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/anima.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/giulio.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/lando.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/glenn.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/fantik.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/romei.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ironhill.jpeg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/inkwell.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/monolith.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/phantom.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ribbit.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/aurel.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/aether.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/cashapp.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/osmo.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/pantheon.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ponpon.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/quentin.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/planetono.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/sanrita.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/anima.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/giulio.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/lando.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/glenn.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/fantik.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/romei.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ironhill.jpeg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/inkwell.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/monolith.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/phantom.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ribbit.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/aurel.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/aether.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/cashapp.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/osmo.png" alt="" />
<img class="image" src="https://assets.codepen.io/16327/pantheon.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/ponpon.jpg" alt="" />
<img class="image" src="https://assets.codepen.io/16327/quentin.png" alt="" />
</div>vendor/gsap-previews/sources/gsap-62087cc4c25f/style.css
body{display:flex;align-items:center;justify-content:center;min-height:100vh;flex-direction: column;}
.header {
text-align: center;
max-width: 560px;
margin-top: 2rem;
margin-bottom: 2rem;
}
.header h1 {
font-weight: 400;
font-size: clamp(1.3rem, 3vw, 1.8rem);
color: var(--light);
margin-bottom: 12px;
letter-spacing: -0.02em;
}
.header p {
font-size: 0.86rem;
color: var(--surface50);
line-height: 1.55;
}
.container {
max-width: 800px;
margin: auto;
width: 100%;
line-height: 0;
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
gap: 1rem;
}
img {
width: 30%;
max-width: 100%;
display: inline-block;
aspect-ratio: 16/9;
object-fit: cover;
margin: 5px;
opacity: 0;
will-change: transform;
border-radius: 5px;
}
header {
position: fixed;
top: 0px;
left: 0px;
padding: 6px 10px 6px 10px;
border-bottom-right-radius: 26px;
z-index: 100;
background-color: rgba(0, 0, 0, 0.5);
}
함께 쓰는 파일 4개 보기
vendor/gsap-previews/sources/gsap-62087cc4c25f/script.js
// https://greensock.com/docs/v3/Plugins/ScrollTrigger/static.batch()
ScrollTrigger.batch(".image", {
// interval: 0.1, // time window (in seconds) for batching to occur.
// batchMax: 3, // maximum batch size (targets)
onEnter: batch => gsap.to(batch, {autoAlpha: 1, stagger: 0.2, duration: 1, ease: "sine.out"}),
// also onLeave, onEnterBack, and onLeaveBack
// also most normal ScrollTrigger values like start, end, etc.
});vendor/gsap-previews/sources/gsap-62087cc4c25f/adapters/host.css실행 안내·자료
/* StyleGallery host styles: independent replacement for unavailable shared Pen CSS. */
:root{--color-just-black:#111522;--color-surface-white:#f7f3ec;--color-surface75:#cfccc6;--color-surface50:#898e9f;--color-surface25:#414859;--color-shockingly-green:#95efd2;--color-lt-green:#b5f4da;--color-pink:#fbadce;--color-purple:#897dff;--color-lilac:#b5a1ff;--color-orangey:#ffd28c;--color-blue:#75d8ed;--color-ui-gradient:linear-gradient(135deg,#fbadce,#897dff);--color-ui-gradient-background:linear-gradient(135deg,#fbadce,#897dff);--color-text-gradient:linear-gradient(135deg,#fbadce,#897dff);--gradient-summer-fair:linear-gradient(135deg,#ffd28c,#fbadce);--gradient-lipstick:linear-gradient(135deg,#fbadce,#fc7f8e);--gradient-macha:linear-gradient(135deg,#b5f4da,#75d8ed);--color-grey:#898e9f;--color-grey-dark:#414859;--color-scroll-pink-lt:#fbadce;--color-text-purple:#b5a1ff;--surface50:#898e9f;--light:#f7f3ec;--dark:#111522;--mid:#898e9f}
*{box-sizing:border-box}body{background:#111522;color:#f7f3ec;font-family:system-ui,sans-serif;margin:0;min-height:100vh;width:100%}button,input{font:inherit}button,.button{background:#111522;border:1px solid #898e9f;border-radius:.55rem;color:#f7f3ec;cursor:pointer;padding:.65rem 1rem}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #95efd2;outline-offset:4px}h1,h2,h3,h4{line-height:1.15}h4{font-weight:500}code{font-family:ui-monospace,monospace}.heading-l{font-size:clamp(2rem,6vw,5rem)}.heading-text{font-size:clamp(1.5rem,4vw,3rem)}.box{background:#95efd2;border-radius:14px;height:clamp(38px,12vw,80px);width:clamp(38px,12vw,80px)}.green{background:#95efd2}.purple{background:#897dff}.orange{background:#ffd28c}.gradient-pink{background:linear-gradient(140deg,#fbadce,#fc7f8e)}.gradient-purple{background:linear-gradient(140deg,#b5a1ff,#537ff7)}.center{align-items:center;display:flex;justify-content:center}.text-center{text-align:center}.panel{min-height:100vh;width:100%}.flair:not(img){background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNDgiIGhlaWdodD0iMjQ4IiB2aWV3Qm94PSIwIDAgMjQ4IDI0OCI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJnIiB4Mj0iMSIgeTI9IjEiPjxzdG9wIHN0b3AtY29sb3I9IiNiNWExZmYiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM3NWQ4ZWQiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48ZyBmaWxsPSJ1cmwoI2cpIj48cGF0aCBkPSJNODcgMjBoNzR2NjdoNjd2NzRoLTY3djY3SDg3di02N0gyMFY4N2g2N1oiLz48L2c+PC9zdmc+");background-position:center;background-repeat:no-repeat;background-size:contain;height:80px;width:80px}.flair--3:not(img){background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNDgiIGhlaWdodD0iMjQ4IiB2aWV3Qm94PSIwIDAgMjQ4IDI0OCI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJnIiB4Mj0iMSIgeTI9IjEiPjxzdG9wIHN0b3AtY29sb3I9IiM5NWVmZDIiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM1MzdmZjciLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48ZyBmaWxsPSJ1cmwoI2cpIj48Y2lyY2xlIGN4PSIxMjQiIGN5PSIxMjQiIHI9Ijg4IiBmaWxsPSJub25lIiBzdHJva2U9InVybCgjZykiIHN0cm9rZS13aWR0aD0iNDgiLz48Y2lyY2xlIGN4PSIxODMiIGN5PSI2MCIgcj0iMjMiIGZpbGw9IiNmNmYzZWIiLz48L2c+PC9zdmc+")}.braces{font-size:1rem}img{max-width:100%}
/* External font programs are omitted; preserve readable fallback typography. */
body,button,input,h1,h2,h3,h4,p,span,div{font-family:inherit}body{font-family:system-ui,sans-serif}code,pre{font-family:ui-monospace,monospace}
vendor/gsap-previews/sources/gsap-62087cc4c25f/adapters/script.js실행 안내·자료
window.__STYLEGALLERY_ASSETS__={};
ScrollTrigger.batch(".image", {
// interval: 0.1, // time window (in seconds) for batching to occur.
// batchMax: 3, // maximum batch size (targets)
onEnter: (batch) => gsap.to(batch, { autoAlpha: 1, stagger: 0.2, duration: 1, ease: "sine.out" })
// also onLeave, onEnterBack, and onLeaveBack
// also most normal ScrollTrigger values like start, end, etc.
});
LICENSE실행 안내·자료
<!--
Copyright (c) 2020 - GreenSock - https://codepen.io/GreenSock/pen/NWGPxGZ
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.
-->
GSAP 3.15.0
Copyright 2026, GreenSock. All rights reserved.
Subject to the Standard No Charge License: https://gsap.com/standard-license.
The full notice in each original GSAP library file is preserved.
StyleGallery host adapter and replacement SVG subjects: locally authored.
BEHIND THE EXAMPLE
이 장면을 만드는 원리
진입 시점으로 묶이는 배치
스크롤 위치가 매 순간 효과를 제어하는지, 진입이 시간 기반 효과를 시작하는지 구분합니다.
- 이 예제에서는
- ScrollTrigger.batch의 onEnter는 전달받은 batch에 1초 autoAlpha 트윈을 만들고 항목마다 0.2초 지연을 줍니다. interval·batchMax는 주석이라 실행 설정이 아니며 leave나 역방향 재숨김도 지정하지 않았습니다. 화면에 나타난 뒤 멈춰도 등장 효과가 완료되는 구조입니다.
코드와 함께 확인하기
