모션·인터랙션 / GSAP / Flip
Animate between layout positions
레이아웃 변경 전후 위치를 Flip으로 자연스럽게 연결합니다.
미리보기 안의 버튼·입력·포인터로 모션을 확인하세요. 실행 방식은 아래 활용 메모를 참고하세요.
실행용 통합 HTML · 공식 GSAP 3.15.0
<!doctype html>
<!-- Source: https://codepen.io/GreenSock/pen/rNMBXxb; archived original panels separately. Runtime: official GSAP 3.15.0. -->
<html lang="en" class=""><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Animate between layout positions</title>
<link rel="stylesheet" href="https://asset.wemashup.com/wp-content/uploads/wm-asset-library/gsap/shared/xxmzBrw.css">
<style>
html,
body {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
overflow: hidden;
}
.container {
position: relative;
width: 90vw;
height: 90vh;
max-width: 700px;
max-height: 700px;
border-radius: 9px;
/* border: solid 2px red; */
}
#element {
background: var(--color-ui-gradient-background);
border-radius: 15px;
width: 100px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
color: var(--color-just-black);
border: solid 2px transparent;
}
#element.absolute,
#absolute-marker {
position: absolute;
bottom: 30px;
right: 30px;
}
#absolute-marker {
width: 100px;
height: 100px;
bottom: 30px;
right: 30px;
border-radius: 10px;
outline: dashed 2px var(--color-surface-white);
z-index: -1;
outline-offset: 0.5rem;
}
button {
position: absolute;
top: 1rem;
left: 50%;
transform: translateX(-50%);
}
</style></head><body>
<div class="container">
<div id="element">
relative
</div>
<div id="absolute-marker"></div>
<button>Change the position</button>
</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-Flip.min.js"></script>
<script>
gsap.registerPlugin(Flip);
let button = document.querySelector("button");
button.addEventListener("click", function() {
// get the current state (before we make changes)
let state = Flip.getState(element, "backgroundColor");
// now make our changes
element.classList.toggle("absolute");
element.innerText = element.classList.contains("absolute") ? "absolute" : "relative";
// "FLIP" animate from that previous state.
Flip.from(state, {
duration: 1,
ease: "power1.inOut",
spin: 2,
});
});
</script></body></html>
원본 HTML
<div class="container">
<div id="element">
relative
</div>
<div id="absolute-marker"></div>
<button>Change the position</button>
</div>원본 CSS
html,
body {
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
overflow: hidden;
}
.container {
position: relative;
width: 90vw;
height: 90vh;
max-width: 700px;
max-height: 700px;
border-radius: 9px;
/* border: solid 2px red; */
}
#element {
background: var(--color-ui-gradient-background);
border-radius: 15px;
width: 100px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
color: var(--color-just-black);
border: solid 2px transparent;
}
#element.absolute,
#absolute-marker {
position: absolute;
bottom: 30px;
right: 30px;
}
#absolute-marker {
width: 100px;
height: 100px;
bottom: 30px;
right: 30px;
border-radius: 10px;
outline: dashed 2px var(--color-surface-white);
z-index: -1;
outline-offset: 0.5rem;
}
button {
position: absolute;
top: 1rem;
left: 50%;
transform: translateX(-50%);
}
원본 JavaScript
gsap.registerPlugin(Flip);
let button = document.querySelector("button");
button.addEventListener("click", function() {
// get the current state (before we make changes)
let state = Flip.getState(element, "backgroundColor");
// now make our changes
element.classList.toggle("absolute");
element.innerText = element.classList.contains("absolute") ? "absolute" : "relative";
// "FLIP" animate from that previous state.
Flip.from(state, {
duration: 1,
ease: "power1.inOut",
spin: 2,
});
});검증·권리 정보
- 실행 검증
- 데스크톱 실행 확인
- 검증 수준
- 샘플 실행
- 권리 확인
- 확인 필요
레이아웃 변경 전후 위치를 Flip으로 자연스럽게 연결합니다.
Chromium 153 · 데스크톱 1280×900 · 격리 iframe에서 button 입력과 화면 변화 확인. 모바일·프로젝트 적용은 미검증.
원본 패널은 보존하고 실행용 문서에 공식 GSAP 3.15.0과 공통 의존성을 연결했습니다. 모션 감소 설정과 실제 프로젝트 적용은 별도로 확인하세요.
보관·활용 메모
GSAP Demo Hub의 공개 예제입니다. 원본 HTML·CSS·JavaScript와 설정, 시연 파일을 함께 보관했습니다. 통합 HTML은 공통 스타일과 실행 의존성을 연결한 파일이며 SCSS는 원본 컴파일 결과를 사용합니다.
구형 CodePen 전용 의존성을 그대로 배포하지 않고, 통합 실행에는 공식 GSAP 3.15.0을 연결했습니다. 원본 패널과 원본 설정은 ZIP에 별도로 보존되어 있습니다. 예제의 이미지·폰트 등 외부 소재 요청은 유지됩니다.
보관일 2026-10-27 · 공개 원본의 코드·제작자·설정을 보존했습니다. GSAP 엔진과 개별 코드·이미지·폰트의 사용 조건은 각각 확인해야 합니다. 자유 재배포 허용으로 판단한 자료가 아닙니다.