GSAP 원본
Animate Between Different Targets
카드 · MIT (public Pen panels); GSAP Standard No Charge License
갤러리 안에서는 화면을 벗어나거나 움직임을 멈추면 예제도 닫힙니다. 다시 재생할 때는 처음부터 시작해요.
저장한 HTML에서는 갤러리의 재생 설정이 적용되지 않아요.
SOURCE FILES
원본 코드 읽기
수집한 원본 소스와 실행 안내를 함께 제공합니다. 실행 HTML에는 미리보기를 위한 실행 환경이 들어 있습니다.
vendor/gsap-previews/sources/gsap-a186880b4e73/index.html
<div class="initial">
<img class="thumbnail" data-flip-id="img" src="https://assets.codepen.io/16327/flip-flair.png">
</div>
<div class="container">
<img class="full-size" data-flip-id="img" src="https://assets.codepen.io/16327/massive-flip-flair.png">
</div>vendor/gsap-previews/sources/gsap-a186880b4e73/style.css
body {
padding: 0;
box-sizing: border-box;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
height: 100vh;
overflow: hidden;
}
h1 {
margin-left: 20px;
}
.container {
position: fixed;
top: 15px;
left: 15px;
right: 15px;
bottom: 15px;
display: flex;
justify-content: center;
align-items: center;
align-content: center;
pointer-events: none;
z-index: 999;
}
.full-size {
position: relative;
flex-shrink: 0;
flex-grow: 0;
height: 80%;
aspect-ratio: 1/1;
display: none;
}
.full-size.active {
display: block;
z-index: 2;
}
.thumbnail {
width: 150px;
height: 150px;
}
.initial {
position: relative;
width: 180px;
height: 180px;
border: dashed 2px var(--color-surface-white);
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
z-index: 1;
}
.initial:after {
content: "drag and click me...";
position: absolute;
background-image: url("data:image/svg+xml,%3Csvg width='100%25' height='100%25' viewBox='0 0 1516 1464' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' xml:space='preserve' xmlns:serif='http://www.serif.com/' style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3E%3Cpath d='M481.106,1059.48c40.533,-60.792 74.612,-125.5 105.72,-191.542c33.38,-70.875 64.242,-142.917 98.3,-213.458c33.85,-70.084 70.951,-139 116.609,-202.209c4.479,-6.208 9.108,-12.333 13.75,-18.416c36.487,-46.334 78.041,-88.125 124.45,-124.542c64.5,-48.917 136.066,-87.458 210.354,-119.333c83.954,-35.042 170.958,-62.167 258.404,-87.042c25.217,-7.167 50.479,-14.125 75.754,-21.083c21.009,-5.792 36.03,-29.834 29.1,-51.25c-6.954,-21.5 -28.737,-35.292 -51.254,-29.125c-100.741,27.708 -201.579,56.041 -299.054,93.958c-101.329,39.417 -197.683,88.458 -283.421,155.792c-84.475,66.375 -151.204,151.666 -205.071,244.125c-53.637,92.042 -95.441,190.25 -139.691,286.958c-41.634,91 -86.405,180.75 -144.725,262.375c-5.73,8.042 -11.613,15.958 -17.588,23.792c-34.783,44.375 -73.808,85.5 -118.171,120.458c-31.387,23.583 -65.154,43.792 -101.121,59.584c-3.295,1.333 -6.608,2.625 -9.929,3.916c29.221,-57.958 56.104,-117.166 79.171,-177.792c15.171,-39.874 28.579,-80.583 37.846,-122.249c2.421,-10.875 1.529,-22.334 -4.2,-32.126c-5.058,-8.625 -14.967,-16.875 -24.9,-19.124c-10.667,-2.459 -22.642,-1.917 -32.108,4.166c-8.871,5.75 -16.788,14.292 -19.15,24.917c-12.555,56.458 -32.48,111.166 -54.746,164.5c-19.3,45.333 -40.504,89.875 -63.046,133.708c-15.325,29.792 -31.233,59.292 -47.879,88.375c-2.946,5.167 -5.9,10.292 -8.938,15.417c-6.841,11.458 -7.191,25 -2.1,37.083c4.634,10.959 14.567,21.917 27,24.125c102.446,18 204.888,36 307.329,54c28.688,5.042 57.371,10.083 86.055,15.125c11.287,1.959 21.891,1.75 32.104,-4.208c8.646,-5.084 16.887,-14.959 19.15,-24.917c2.429,-10.666 1.904,-22.625 -4.2,-32.083c-5.563,-8.625 -14.379,-17.334 -24.9,-19.167c-93.467,-16.416 -186.929,-32.833 -280.392,-49.25c62.683,-23.708 119.513,-59.458 170.283,-103.5c56.417,-48.916 103.888,-107.958 145.205,-169.958Z' style='fill:%23fffce1;fill-rule:nonzero;'/%3E%3C/svg%3E");
width:200px;
height: 72px;
background-size: 60px;
padding-left: 75px;
background-position: bottom left;
background-repeat: no-repeat;
text-align: left;
bottom: 100%;
margin-bottom: 0.2rem;
margin-left: 0.5rem;
left: 100%;
}
.thumbnail.active {
visibility: hidden;
}
.thumbnail,
.thumbnail.flipping {
visibility: visible;
}
함께 쓰는 파일 4개 보기
vendor/gsap-previews/sources/gsap-a186880b4e73/script.js
gsap.registerPlugin(Flip, Draggable);
const fullSize = document.querySelector(".full-size"),
thumbnail = document.querySelector(".thumbnail");
Draggable.create(".initial", {bounds: "body"});
document.addEventListener("click", () => {
const state = Flip.getState(".thumbnail, .full-size");
fullSize.classList.toggle("active");
thumbnail.classList.toggle("active");
Flip.from(state, {
duration: 0.6,
fade: true,
absolute: true,
toggleClass: "flipping",
ease: "power1.inOut"
});
});
vendor/gsap-previews/sources/gsap-a186880b4e73/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);--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-a186880b4e73/adapters/script.js실행 안내·자료
window.__STYLEGALLERY_ASSETS__={};
gsap.registerPlugin(Flip, Draggable);
const fullSize = document.querySelector(".full-size"), thumbnail = document.querySelector(".thumbnail");
Draggable.create(".initial", { bounds: "body" });
document.addEventListener("click", () => {
const state = Flip.getState(".thumbnail, .full-size");
fullSize.classList.toggle("active");
thumbnail.classList.toggle("active");
Flip.from(state, {
duration: 0.6,
fade: true,
absolute: true,
toggleClass: "flipping",
ease: "power1.inOut"
});
});
LICENSE실행 안내·자료
<!--
Copyright (c) 2020 - GreenSock - https://codepen.io/GreenSock/pen/XWKLYWe
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
이 장면을 만드는 원리
서로 다른 노드를 연결하는 식별자
시각 연결 전에 출발과 도착을 같은 항목으로 대응시킬 근거가 필요합니다.
- 이 예제에서는
- thumbnail과 full-size는 별개 img지만 data-flip-id="img"를 공유합니다. 클릭 시 두 active 클래스를 바꾼 뒤 이전 두 노드의 상태에서 Flip.from을 실행합니다. 확대된 화면은 모달이나 새 경로가 아니며 Escape·초점 이동은 구현되어 있지 않습니다.
코드와 함께 확인하기
코드에서 찾기
data-flip-id="img"index.html별개 이미지 노드의 대응을 선언합니다.
Flip.getState(".thumbnail, .full-size")script.js클래스 변경 전에 두 노드의 기하를 기록합니다.
직접 해보기
확대 도중 다시 클릭하고 축소 도중 다시 클릭합니다.
살펴볼 변화현재 active 상태와 보이는 이미지가 일치하는지 확인합니다.
작은 프레임을 옮긴 뒤 확대합니다.
살펴볼 변화옮겨진 시작 위치에서 연결되는지 확인하며 이 데모를 초점 관리가 있는 모달로 설명하지 않습니다.
