Codrops 원본
Animated Product Grid Preview with GSAP & Clip-Path
섹션 · MIT
갤러리 안에서는 화면을 벗어나거나 움직임을 멈추면 예제도 닫힙니다. 다시 재생할 때는 처음부터 시작해요.
SOURCE FILES
원본 코드 읽기
수집한 원본 소스와 실행 안내를 함께 제공합니다.
prettier.config.cjs
module.exports = {
semi: false,
singleQuote: true,
tabWidth: 2,
trailingComma: 'none',
printWidth: 1000
}
src/index.html
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GridToFullPreview | Codrops</title>
<meta name="author" content="Gwen Bogaert for Codrops" />
<link rel="shortcut icon" href="https://tympanus.net/favicon/favicon.ico" />
<link rel="stylesheet" type="text/css" href="css/base.css" />
<script>
document.documentElement.className = 'js'
</script>
</head>
<body class="loading">
<main>
<header class="frame">
<h1 class="frame__title">Grid to Full Preview</h1>
<a class="frame__back" href="https://tympanus.net/codrops/?p=93410">Article</a>
<a class="frame__archive" href="https://tympanus.net/codrops/demos/">All demos</a>
<a class="frame__github" href="https://github.com/gwen-bo/codrops-grid-to-preview">GitHub</a>
<nav class="frame__tags">
<a href="https://tympanus.net/codrops/demos/?tag=grid">#grid</a>
<a href="https://tympanus.net/codrops/demos/?tag=hover">#hover</a>
<a href="https://tympanus.net/codrops/demos/?tag=gsap">#gsap</a>
</nav>
</header>
<div class="content">
<!-- decorative only -->
<nav class="shop-categories">
<ul>
<li class="--active">All <sup>8</sup></li>
<li>Chairs <sup>2</sup></li>
<li>Tables <sup>1</sup></li>
<li>Decoration <sup>3</sup></li>
<li>Cabinets <sup>2</sup></li>
</ul>
</nav>
<p class="breakpoint-disclaimer">🖥️ Seems like this demo best suited for desktop.</p>
<!-- decorative only -->
<div class="products">
<ul class="products__grid">
<li class="product" data-name="Candle holder" data-price="25" data-index="0">
<div class="product__cta"><p>Add to cart</p></div>
<img class="loading" src="./assets/products/product-1.webp" alt="A candle holder with glass, mosaic and chrome details" width="1024" height="1536" />
</li>
<li class="product" data-name="Cow vase" data-price="40" data-index="1">
<div class="product__cta"><p>Add to cart</p></div>
<img class="loading" src="./assets/products/product-2.webp" alt="A vase in the shape of a cow, with a plant inside" width="1024" height="1536" />
</li>
<li class="product" data-name="Chrome and blue book shelf" data-price="200" data-index="2">
<div class="product__cta"><p>Add to cart</p></div>
<img class="loading" src="./assets/products/product-3.webp" alt="A blue and chrome bookshelf" width="1024" height="1536" />
</li>
<li class="product" data-name="Wooden sidetable with smoke glass detail" data-price="120" data-index="3">
<div class="product__cta"><p>Add to cart</p></div>
<img class="loading" src="./assets/products/product-4.webp" alt="A wooden sidetable with one part in smoked glass" width="1024" height="1536" />
</li>
<li class="product" data-name="Yellow armchair" data-price="220" data-index="4">
<div class="product__cta"><p>Add to cart</p></div>
<img class="loading" src="./assets/products/product-5.webp" alt="A yellow armchair/sofa" width="1024" height="1536" />
</li>
<li class="product" data-name="Wooden cabinet with fluted glass" data-price="200" data-index="5">
<div class="product__cta"><p>Add to cart</p></div>
<img class="loading" src="./assets/products/product-6.webp" alt="A wooden cabinet with doors of fluted glass" width="1024" height="1536" />
</li>
<li class="product" data-name="Orange clock" data-price="30" data-index="6">
<div class="product__cta"><p>Add to cart</p></div>
<img class="loading" src="./assets/products/product-7.webp" alt="Orange clock with beige, organic hands" width="1024" height="1536" />
</li>
<li class="product" data-name="Red chair with chrome legs" data-price="50" data-index="7">
<div class="product__cta"><p>Add to cart</p></div>
<img class="loading" src="./assets/products/product-8.webp" alt="Red chair with chrome legs" width="1024" height="1536" />
</li>
</ul>
<div class="products__preview">
<div class="product-preview --left">
<div class="product-preview__images">
<!-- all detail images -->
<img data-id="2" src="./assets/products/product-3.webp" alt="product-image" width="1024" height="1536" />
<img data-id="2" src="./assets/products/product-3-detail-1.webp" alt="product-image" width="1024" height="1536" />
<img data-id="2" src="./assets/products/product-3-detail-2.webp" alt="product-image" width="1024" height="1536" />
<img data-id="3" src="./assets/products/product-4.webp" alt="product-image" width="1024" height="1536" />
<img data-id="3" src="./assets/products/product-4-detail-1.webp" alt="product-image" width="1024" height="1536" />
<img data-id="3" src="./assets/products/product-4-detail-2.webp" alt="product-image" width="1024" height="1536" />
<img data-id="6" src="./assets/products/product-7.webp" alt="product-image" width="1024" height="1024" />
<img data-id="6" src="./assets/products/product-7-detail-1.webp" alt="product-image" width="1024" height="1024" />
<img data-id="6" src="./assets/products/product-7-detail-2.webp" alt="product-image" width="1024" height="1536" />
<img data-id="7" src="./assets/products/product-8.webp" alt="product-image" width="1024" height="1536" />
<img data-id="7" src="./assets/products/product-8-detail-1.webp" alt="product-image" width="1024" height="1536" />
<img data-id="7" src="./assets/products/product-8-detail-2.webp" alt="product-image" width="1024" height="1536" />
<!-- end of all detail images -->
</div>
<div class="product-preview__details">
<p class="product-title">product title</p>
<p>€ <span class="product-price">0</span></p>
</div>
<div class="product-preview__inside masked-preview"></div>
</div>
<div class="product-preview --right">
<div class="product-preview__images">
<!-- all detail images -->
<img data-id="0" src="./assets/products/product-1.webp" alt="product-image" width="1024" height="1536" />
<img data-id="0" src="./assets/products/product-1-detail-1.webp" alt="product-image" width="1024" height="1536" />
<img data-id="0" src="./assets/products/product-1-detail-2.webp" alt="product-image" width="1024" height="1536" />
<img data-id="1" src="./assets/products/product-2.webp" alt="product-image" width="1024" height="1536" />
<img data-id="1" src="./assets/products/product-2-detail-1.webp" alt="product-image" width="1024" height="1536" />
<img data-id="1" src="./assets/products/product-2-detail-2.webp" alt="product-image" width="1024" height="1024" />
<img data-id="4" src="./assets/products/product-5.webp" alt="product-image" width="1024" height="1536" />
<img data-id="4" src="./assets/products/product-5-detail-1.webp" alt="product-image" width="1024" height="1536" />
<img data-id="4" src="./assets/products/product-5-detail-2.webp" alt="product-image" width="1024" height="1536" />
<img data-id="5" src="./assets/products/product-6.webp" alt="product-image" width="1024" height="1536" />
<img data-id="5" src="./assets/products/product-6-detail-1.webp" alt="product-image" width="1024" height="1024" />
<img data-id="5" src="./assets/products/product-6-detail-2.webp" alt="product-image" width="1024" height="1536" />
<!-- end of all detail images -->
</div>
<div class="product-preview__details">
<p class="product-title">product title</p>
<p>€ <span class="product-price">0</span></p>
</div>
<div class="product-preview__inside masked-preview"></div>
</div>
</div>
</div>
</div>
</main>
<script type="module" src="/js/main.js"></script>
</body>
</html>
함께 쓰는 파일 12개 보기
src/js/main.js
import '../styles/main.scss'
import ProductGrid from './product-grid'
import { preloadImages } from './utils'
window.addEventListener('load', async () => {
new ProductGrid()
// load all the images
const images = [...document.querySelectorAll('img')]
await preloadImages(images).then(() => {
document.body.classList.remove('loading')
})
})
src/js/product-grid.js
import ProductPreview from './product-preview'
import debounce from 'debounce'
export default class ProductGrid {
constructor() {
this.ui = {
products: Array.from(document.querySelectorAll('.product')),
containerLeft: document.querySelector('.product-preview.--left'),
containerRight: document.querySelector('.product-preview.--right')
}
this.productPreviewLeft = null
this.productPreviewRight = null
this.activeProduct = null
this.hoverDelay = null
this.init()
}
init() {
this.productPreviewLeft = new ProductPreview({
container: this.ui.containerRight,
products: this.ui.products.filter((_, i) => i % 4 === 2 || i % 4 === 3)
})
this.productPreviewRight = new ProductPreview({
container: this.ui.containerLeft,
products: this.ui.products.filter((_, i) => i % 4 === 0 || i % 4 === 1)
})
this.addEvents()
}
addEvents() {
window.addEventListener(
'resize',
debounce(() => {
this.productPreviewRight.onResize()
this.productPreviewLeft.onResize()
})
)
this.ui.products.forEach((product) => {
const previewController = this.getProductSide(product)
product.addEventListener('mouseenter', () => this.productMouseEnter(product, previewController))
product.addEventListener('mouseleave', () => this.productMouseLeave())
})
}
getProductSide = (product) => {
const i = product.dataset.index
const isLeft = i % 4 === 0 || i % 4 === 1
return isLeft ? this.productPreviewLeft : this.productPreviewRight
}
productMouseEnter(product, preview) {
// If another timer (aka hover) was running, cancel it
if (this.hoverDelay) {
clearTimeout(this.hoverDelay)
this.hoverDelay = null
}
// Start a new timer
this.hoverDelay = setTimeout(() => {
this.activeProduct = product
preview.setProduct(product)
this.hoverDelay = null // clear reference
}, 100)
}
productMouseLeave() {
// If user leaves before debounce completes
if (this.hoverDelay) {
clearTimeout(this.hoverDelay)
this.hoverDelay = null
}
if (this.activeProduct) {
const preview = this.getProductSide(this.activeProduct)
preview.setProduct(null)
this.activeProduct = null
}
}
}
src/js/product-preview.js
import { gsap } from 'gsap'
export default class ProductPreview {
constructor({ products, container }) {
// Group by product ID
const allPreviewImages = container.querySelector('.product-preview__images').children
const previewImages = {}
Array.from(allPreviewImages).forEach((img) => {
const id = img.dataset.id
if (!previewImages[id]) {
previewImages[id] = []
}
previewImages[id].push(img)
})
this.ui = {
products,
container: container,
clipped: container.querySelector('.masked-preview'),
title: container.querySelector('.product-title'),
price: container.querySelector('.product-price'),
allPreviewImages: allPreviewImages,
previewImagesPerID: previewImages
}
this.scaleFactor = 5
this.armWidth = { x: 10, y: 10 }
this.galleryTimeline
this.timeline
this.init()
}
init() {
this.onResize() // build timeline is called within onResize
}
setProduct(product) {
this.galleryTimeline && this.galleryTimeline.kill()
if (product) {
this.ui.title.innerHTML = product.dataset.name
this.ui.price.innerHTML = product.dataset.price
gsap.set(this.ui.allPreviewImages, { opacity: 0 })
gsap.set(this.ui.previewImagesPerID[product.dataset.index], { opacity: 1 })
this.timeline.play().then(this.startPreviewGallery(product.dataset.index))
} else {
this.timeline.reverse()
this.galleryTimeline.kill()
}
}
buildTimeline() {
const { x, y } = this.armWidth
this.timeline = gsap
.timeline({ paused: true, defaults: { ease: 'power2.inOut' } })
.addLabel('preview', 0)
.addLabel('products', 0)
.to(this.ui.container, { opacity: 1 }, 'preview')
.to(this.ui.container, { scaleX: this.scaleFactor.x, scaleY: this.scaleFactor.y, transformOrigin: 'center center' }, 'preview')
.to(
this.ui.products,
{
opacity: 0,
x: (i) => {
return i % 2 === 0 ? '2.5vw' : '-2.5vw'
},
y: (i) => {
return i < 2 ? '2.5vw' : '-2.5vw'
}
},
'products'
)
.fromTo(
this.ui.clipped,
{
clipPath: `polygon(
${50 - x / 2}% 0%,
${50 + x / 2}% 0%,
${50 + x / 2}% ${50 - y / 2}%,
100% ${50 - y / 2}%,
100% ${50 + y / 2}%,
${50 + x / 2}% ${50 + y / 2}%,
${50 + x / 2}% 100%,
${50 - x / 2}% 100%,
${50 - x / 2}% ${50 + y / 2}%,
0% ${50 + y / 2}%,
0% ${50 - y / 2}%,
${50 - x / 2}% ${50 - y / 2}%
)`
},
{
clipPath: `polygon(
50% 0%,
50% 0%,
50% 50%,
100% 50%,
100% 50%,
50% 50%,
50% 100%,
50% 100%,
50% 50%,
0% 50%,
0% 50%,
50% 50%
)`
},
'preview'
)
}
startPreviewGallery(id) {
const images = this.ui.previewImagesPerID[id]
const timeline = gsap.timeline({ repeat: -1 })
gsap.set([...images].slice(1), { opacity: 0 })
images.forEach((image) => {
timeline
.set(images, { opacity: 0 }) // Hide all images
.set(image, { opacity: 1 }) // Show only this one
.to(image, { duration: 0, opacity: 1 }, '+=0.5') // Wait 0.5s before moving to next
})
this.galleryTimeline = timeline
}
onResize() {
const { width, height } = this.ui.container.getBoundingClientRect()
const vw = window.innerWidth / 100
// 1. calculate the 'arms' width for the clip path (cross)
const armWidthVw = 5
const armWidthPx = armWidthVw * vw
this.armWidth = {
x: (armWidthPx / width) * 100,
y: (armWidthPx / height) * 100
}
// 2. calculate the scale for the preview container
const widthInVw = width / vw
const heightInVw = height / vw
const shrinkVw = 5
this.scaleFactor = {
x: (widthInVw - shrinkVw) / widthInVw,
y: (heightInVw - shrinkVw) / heightInVw
}
this.rebuildTimeline()
}
rebuildTimeline() {
this.timeline?.kill() // kill the current timeline
this.buildTimeline() // rebuild
}
}
src/js/utils.js
export function preloadImages(imageElements) {
const promises = [...imageElements].map((img) => {
if (img.complete) return Promise.resolve() // Already cached
return new Promise((resolve, reject) => {
img.onload = resolve
img.onerror = resolve // Resolve even on error to avoid blocking
})
})
return Promise.all(promises)
}
src/styles/global.scss
*,
*::after,
*::before {
box-sizing: border-box;
}
:root {
font-size: 12px;
--color-text: #000;
--color-bg: #efefef;
--color-link: #000;
--color-link-hover: #000;
--page-padding: 1.5rem;
}
body {
margin: 0;
color: var(--color-text);
background-color: var(--color-bg);
font-family: sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
.breakpoint-disclaimer {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.products,
.shop-categories {
display: none;
}
@media (min-width: 900px) {
.breakpoint-disclaimer {
display: none;
}
.products,
.shop-categories {
display: block;
}
}
}
@media (scripting: enabled) {
.loading {
&::before,
&::after {
content: '';
position: fixed;
z-index: 10000;
}
&::before {
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--color-bg);
}
&::after {
top: 50%;
left: 50%;
width: 100px;
height: 1px;
margin: 0 0 0 -50px;
background: var(--color-link);
animation: loaderAnim 1.5s ease-in-out infinite alternate forwards;
}
}
}
@keyframes loaderAnim {
0% {
transform: scaleX(0);
transform-origin: 0% 50%;
}
50% {
transform: scaleX(1);
transform-origin: 0% 50%;
}
50.1% {
transform: scaleX(1);
transform-origin: 100% 50%;
}
100% {
transform: scaleX(0);
transform-origin: 100% 50%;
}
}
a {
text-decoration: none;
color: var(--color-link);
outline: none;
opacity: 0.3;
cursor: pointer;
&:hover {
text-decoration: none;
opacity: 1;
color: var(--color-link-hover);
}
&:focus {
outline: none;
background: lightgrey;
&:not(:focus-visible) {
background: transparent;
}
&:focus-visible {
outline: 2px solid red;
background: transparent;
}
}
}
.frame {
font-size: 12px;
padding: 1rem;
display: grid;
z-index: 1000;
position: relative;
grid-row-gap: 1rem;
grid-column-gap: 2rem;
pointer-events: none;
justify-items: start;
grid-template-columns: auto auto;
grid-template-areas:
'title'
'back'
'archive'
'github'
'demos'
'tags'
'sponsor';
#cdawrap {
grid-area: sponsor;
}
a,
button {
pointer-events: auto;
}
.frame__title {
grid-area: title;
font-size: inherit;
margin: 0;
}
.frame__back {
grid-area: back;
justify-self: start;
}
.frame__archive {
grid-area: archive;
justify-self: start;
}
.frame__github {
grid-area: github;
}
.frame__tags {
grid-area: tags;
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
.frame__demos {
grid-area: demos;
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
@media screen and (min-width: 53em) {
position: fixed;
padding: 1rem 5.5rem;
bottom: 0;
left: 0;
width: 100%;
grid-template-columns: auto auto auto auto auto 1fr;
grid-template-rows: auto auto;
align-content: center;
justify-content: center;
grid-template-areas: 'title back github archive tags sponsor';
#cdawrap {
text-align: right;
}
}
}
.content {
height: 100svh;
width: 100svw;
display: flex;
flex-direction: column;
position: relative;
font-family: Georgia, 'Times New Roman', Times, serif;
@media screen and (min-width: 53em) {
min-height: 100vh;
justify-content: center;
align-items: center;
}
}
src/styles/reset.scss
html, body,
p, ol, ul, li, dl, dt, dd, blockquote,
figure, fieldset, legend, pre, iframe, hr,
h1, h2, h3, h4, h5, h6 {
margin-block: 0;
margin: 0;
padding: 0;
border: none;
}
html {
line-height: 1.15;
-webkit-text-size-adjust: 100%;
}
main {
display: block;
}
progress {
vertical-align: middle;
}
h1, h2, h3, h4, h5, h6 {
font-size: inherit;
font-weight: inherit;
}
b, strong {
display: inline-block;
font-weight: bold;
}
q, blockquote {
font-style: italic;
}
hr {
display: block;
box-sizing: content-box;
height: 0;
overflow: visible;
}
ol, ul {
list-style: none;
}
audio,
canvas,
iframe,
svg,
video,
img {
vertical-align: middle;
}
img {
max-width: 100%;
border-style: none;
}
button,
input,
select,
textarea {
margin: 0;
border: 0;
background: transparent;
font-family: inherit;
font-size: 100%;
line-height: inherit;
&:focus {
outline: transparent;
}
}
input {
border-radius: 0;
&[type="search"] {
-webkit-appearance: none;
}
&::-moz-focus-inner {
border: 0;
}
}
textarea {
white-space: revert;
overflow: auto;
resize: none;
}
a,
a:visited,
a:active {
display: inline-block;
color: inherit;
text-decoration: none;
}
a[href],
button {
touch-action: manipulation;
}
button, input {
overflow: visible;
}
button, select {
text-transform: none;
}
button {
padding: 0;
border: 0;
background: transparent;
}
button,
[type="button"],
[type="reset"],
[type="submit"] {
-webkit-appearance: button;
color: inherit;
cursor: pointer;
}
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
border-style: none;
padding: 0;
}
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
outline: 1px dotted ButtonText;
}
[type="checkbox"],
[type="radio"] {
box-sizing: border-box;
padding: 0;
}
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
height: auto;
}
[type="search"] {
-webkit-appearance: textfield;
outline-offset: -2px;
&::-webkit-search-decoration {
-webkit-appearance: none;
}
}
* {
box-sizing: border-box;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
&::before,
&::after {
box-sizing: inherit;
}
}
::-webkit-file-upload-button {
-webkit-appearance: button;
font: inherit;
}
// small {
// font-size: 80%;
// }
// sub, sup {
// font-size: 75%;
// line-height: 0;
// position: relative;
// vertical-align: baseline;
// }
// sub {
// bottom: -0.25em;
// }
// sup {
// top: -0.5em;
// }
// code, kbd, pre, samp {
// font-family: monospace, monospace;
// font-size: 0.9em;
// }src/styles/shop.scss
// decorative
.shop-categories {
position: absolute;
top: 1.5rem;
left: 50%;
transform: translate(-50%, 0);
ul {
list-style: none;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 24px;
li {
font-size: 20px;
opacity: 0.3;
white-space: nowrap;
sup {
font-size: 0.6em;
}
&.--active {
opacity: 1;
}
}
}
}
// decorative
.products {
position: relative;
height: 100svh;
width: 100svw;
overflow: hidden;
padding: var(--page-padding);
display: flex;
align-items: center;
justify-content: center;
&__grid,
&__preview {
height: 100%;
width: 100%;
display: grid;
padding: 48px;
grid-template-columns: repeat(4, 1fr);
grid-template-rows: repeat(2, 1fr);
row-gap: 5vw;
column-gap: 5vw;
}
&__grid {
position: relative;
// z-index: 5;
}
&__preview {
position: absolute;
inset: var(--page-padding);
height: calc(100% - var(--page-padding) * 2);
width: calc(100% - var(--page-padding) * 2);
pointer-events: none;
z-index: 2;
}
}
.product {
position: relative;
display: block;
width: 100%;
height: 100%;
contain: size;
cursor: pointer;
&:hover {
.product__cta {
opacity: 1;
}
}
&__cta {
opacity: 0;
transition: all 0.1s ease-out;
position: absolute;
top: 50%;
left: 0;
right: 0;
z-index: 5;
padding: 10px 0;
background-color: rgba($color: #000000, $alpha: 0.8);
color: var(--color-bg);
text-align: center;
transform: translate(0, -50%);
pointer-events: none;
}
}
img {
position: relative;
object-fit: cover;
width: 100%;
height: 100%;
}
.product-preview {
height: 100%;
width: 100%;
position: relative;
grid-column: auto / span 2;
grid-row: 1 / span 2;
opacity: 0;
&__inside {
position: absolute;
inset: 0;
height: 100%;
width: 100%;
background: var(--color-bg);
}
&__images {
display: grid;
grid-template-columns: auto;
grid-template-rows: auto;
width: 100%;
height: 100%;
overflow: hidden;
> img {
grid-column: 1;
grid-row: 1;
opacity: 0;
}
}
&__details {
z-index: 3;
position: absolute;
top: calc(100% + 8px);
left: 0;
width: 100%;
display: flex;
justify-content: space-between;
color: black;
font-size: 12px;
text-transform: uppercase;
}
}
vite.config.js
import { resolve } from 'path'
export default {
root: 'src/',
publicDir: '../static/',
base: './',
server: {
host: true,
open: true,
},
build: {
outDir: '../dist',
emptyOutDir: true,
sourcemap: true,
rollupOptions: {
input: {
index: resolve(__dirname, 'src/index.html'),
},
},
},
css: {
preprocessorOptions: {
scss: {
api: 'modern'
}
}
},
}Media credits and license evidence실행 안내·자료
README.md
## Credits
- Creative concept by [Gaetan Ferhah](https://gaetanferhah.com/)
- Images generated with [DALL·E (OpenAI)](https://openai.com/index/dall-e/)
## License
[MIT](LICENSE)
LICENSE실행 안내·자료
MIT License
Copyright (c) 2009 - 2024 [Codrops](https://tympanus.net/codrops)
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.
Bundled dependency licenses실행 안내·자료
GSAP standard license snapshot
Source: https://gsap.com/community/standard-license/
Retrieved: 2026-09-22T04:22:49.089Z
Original distribution copyright and version headers remain in the runtime code.
Standard "No Charge" GSAP License
I. DEFINITIONS
“GSAP License” means the terms and conditions of this GSAP Software License Agreement.
"GSAP Products" means any Software made available at gsap.com (https://gsap.com) or any successor sites, including but not limited to the GSAP animation library and related plugins, tools, or extensions.
"Permitted Uses" means the implementation and/or use of GSAP Products on any website, web application, or digital interface by any person or entity (which may include, for clarity, those of companies that compete with Webflow in other areas of business).
"Prohibited Uses" means any implementation and/or use of GSAP Products in tools that allow users to build visual animations without code that encourages, induces, or materially assists in creating a solution that competes with Webflow’s visual animation building capabilities.
"Competitive Products" means any software, tool, or service that enables users to create, edit, or manage animations through a visual interface or builder similar to Webflow (https://webflow.com).
II. GRANT OF LICENSE
Subject to the terms and conditions of this GSAP License, Webflow grants you a non-exclusive, worldwide license to use, reproduce, display, and implement GSAP Products solely for Permitted Uses.
III. RESTRICTIONS
You may not:
Use any GSAP Products for any Prohibited Uses without prior written consent;
Reverse engineer any GSAP Products for the purpose of creating Competitive Products;
Remove or alter any proprietary notices or branding from GSAP Products.
IV. OWNERSHIP AND INTELLECTUAL PROPERTY
All intellectual property rights in GSAP Products, including but not limited to copyright, patents, trademarks, and trade secrets, remain the exclusive property of Webflow. This GSAP License does not transfer any ownership rights in GSAP Products to you.
V. TERMINATION
Webflow may terminate this GSAP License and revoke your access in its discretion if you fail to comply with any of these terms and conditions. Upon termination, you must cease all use of GSAP Products and destroy all copies in your possession.
VI. MISCELLANEOUS PROVISIONS
General: This GSAP License is incorporated into and subject to Webflow’s Terms of Service available here (https://webflow.com/legal/terms) ("Terms of Service"). In the event of any conflict or inconsistency between this GSAP License and the Terms of Service, the terms of this GSAP License shall govern in relation to your use of any GSAP Products.
Amendments: Webflow reserves the right to update or modify this GSAP License at any time by posting the revised terms on this website, provided that any such updates or modifications shall not result in any material degradation to the security, integrity, or functionality of any GSAP Products. You understand and agree that your continued use of any GSAP Products after such revisions to this GSAP License constitutes your acceptance of this GSAP License as revised. If you do not accept the revised GSAP License, you are prohibited from using versions of the GSAP Products released after the effective date of the revised GSAP License (as well as any updates made to previous versions). Notwithstanding, you may continue using previous versions of GSAP Products under the applicable terms licensed to you prior to the effective date of the revised GSAP License (for clarity, excluding any updates made thereto).
No Waiver: Failure of Webflow to enforce any provision of this GSAP License shall not constitute a waiver of future enforcement of that or any other provision.
FAQ
Is it acceptable for AI tools like ChatGPT, Cursor, Lovable, Webstudio, etc. to generate GSAP code?
Absolutely! AI-generated code is not a "Prohibited Use".
What if a WordPress plugin or theme or other niche tool allows users to create GSAP-driven effects through a visual interface? Is that prohibited?
We want to encourage developers to build on top of GSAP, including visual tools that don't directly compete with Webflow's rich animation-building capabilities. If you are not sure if your product might be considered a "Prohibited Use", feel free to contact us (https://gsap.com/contact) so we can talk through it!
Can I really use GSAP in commercial projects without paying anything?
Yes, really! Commercial usage is covered under the standard license. All of GSAP including the plugins that were formerly "members-only" like SplitText (https://gsap.com/docs/v3/Plugins/SplitText/) and MorphSVG (https://gsap.com/docs/v3/Plugins/MorphSVGPlugin) can be used in commercial projects at no charge. Enjoy! 💚
Effective date: April 30, 2025
Last modified date: May 30, 2025
Copyright (©) 2025, Webflow
debounce@2.2.0 — license
MIT License
Coprighht (c) Jeremy Ashkenas, Julian Gonggrijp, DocumentCloud, Investigative Reporters & Editors
Copyright (c) Ben Carpenter, Billy Moon, Josh Goldberg, Julian Gruber, Kristofer Selbekk, Matthew Mueller, Nathan Rajlich, Oleg Pudeyev, Stephen Mathieson, TJ Holowaychuk, suhaotian, ven
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
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.
BEHIND THE EXAMPLE
이 장면을 만드는 원리
미리보기 시작 시점과 반복 재생의 소유자
반복 입력에서 현재 의도와 전환의 종료·취소 책임을 명시합니다.
- 이 예제에서는
- setProduct는 이전 galleryTimeline을 종료하고 상품별 이미지 묶음을 선택합니다. then 인수에서 startPreviewGallery를 직접 호출하므로 갤러리 시작은 전환 완료 콜백으로 지연되지 않습니다.
코드와 함께 확인하기
코드에서 찾기
setProductproduct-preview.jstimeline.play().then(this.startPreviewGallery(...))의 실제 호출 순서를 확인할 지점입니다.
직접 해보기
첫 전환이 끝나기 전에 다른 상품을 선택하고 닫습니다.
살펴볼 변화이전 상품의 반복이 남지 않는지, 시작을 완료 후로 의도했다면 호출 순서를 고쳐야 하는지 확인해야 합니다.
