GSAP 원본
easeReverse - UI interactions
버튼 · MIT (public Pen panels); GSAP Standard No Charge License
갤러리 안에서는 화면을 벗어나거나 움직임을 멈추면 예제도 닫힙니다. 다시 재생할 때는 처음부터 시작해요.
저장한 HTML에서는 갤러리의 재생 설정이 적용되지 않아요.
SOURCE FILES
원본 코드 읽기
수집한 원본 소스와 실행 안내를 함께 제공합니다. 실행 HTML에는 미리보기를 위한 실행 환경이 들어 있습니다.
vendor/gsap-previews/sources/gsap-110595bf0a80/index.html
<h1>easeReverse - UI interactions</h1>
<p class="subtitle">Toggle easeReverse off to feel how awkward more expressive eases like <code>elastic</code> and <code>back</code> can feel in reverse and how <code>easeReverse</code> and <code>timeScale</code> can help to smooth out the exit.</p>
<div class="toggle-bar">
<input type="checkbox" id="erToggle" checked />
<label for="erToggle"><code>easeReverse</code></label>
<span style="margin-left:12px;">exit speed</span>
<input type="range" id="exitSlider" min="1" max="5" step="0.5" value="2.5"
style="width:80px;accent-color:var(--green);" />
<span id="exitVal" style="font-family:Fraktion Mono,monospace;font-size:.72rem;min-width:2.5em;">2.5×</span>
</div>
<div class="demos">
<div class="demo-card">
<span class="demo-label">Button hover</span>
<button class="hover-btn" id="hoverBtn">Hover me</button>
</div>
<div class="demo-card">
<span class="demo-label">Dropdown</span>
<div class="dropdown-wrap" id="dropdownWrap">
<button class="dropdown-trigger" id="dropdownTrigger">
Options
<svg class="dd-arrow" width="12" height="12" viewBox="0 0 12 12" fill="none">
<path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</button>
<div class="dropdown-menu" id="dropdownMenu">
<div class="dropdown-item">Profile</div>
<div class="dropdown-item">Settings</div>
<div class="dropdown-item">Logout</div>
</div>
</div>
</div>
<div class="demo-card">
<span class="demo-label">Tooltip</span>
<div class="tooltip-wrap" id="tooltipWrap">
<div class="tooltip-target">?</div>
<div class="tooltip-bubble" id="tooltipBubble">Handy little tooltip</div>
</div>
</div>
</div>vendor/gsap-previews/sources/gsap-110595bf0a80/style.css
@font-face {
font-display: block;
font-family: Mori;
font-weight: 400;
src: url(https://assets.codepen.io/16327/PPMori-Regular.woff) format("woff");
}
@font-face {
font-display: block;
font-family: Mori;
font-weight: 600;
src: url(https://assets.codepen.io/16327/PPMori-SemiBold.woff) format("woff");
}
@font-face {
font-display: block;
font-family: Fraktion Mono;
font-weight: 400;
src: url(https://assets.codepen.io/16327/PPFraktionMono-Bold.woff)
format("woff");
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
transition: none !important;
animation: none !important;
}
:root {
--green: #0ae448;
--lt: #abff84;
--black: #0e100f;
--white: #fffce1;
--grey: #191919;
--s75: #bbbaa6;
--s50: #7c7c6f;
--s25: #191919;
}
body {
font-family: Mori, sans-serif;
background: var(--black);
color: var(--s75);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px 20px 60px;
gap: 48px;
}
code {
font-family: Fraktion Mono, monospace;
font-size: 0.72rem;
background: rgba(10, 228, 72, 0.08);
color: var(--green);
padding: 2px 6px;
border-radius: 3px;
}
h1 {
color: var(--white);
font-weight: 400;
font-size: 1.4rem;
text-align: center;
}
.subtitle {
color: var(--s50);
font-size: 0.82rem;
text-align: center;
max-width: 55ch;
margin-top: -32px;
}
.toggle-bar {
display: flex;
align-items: center;
gap: 10px;
font-size: 0.78rem;
color: var(--s50);
}
.toggle-bar input {
accent-color: var(--green);
}
.toggle-bar code {
font-family: Fraktion Mono, monospace;
font-size: 0.72rem;
background: var(--grey);
color: var(--green);
padding: 2px 6px;
border-radius: 4px;
}
.demos {
display: flex;
flex-wrap: wrap;
gap: 40px;
justify-content: center;
width: 100%;
max-width: 900px;
}
.demo-card {
background: var(--grey);
border: 1px solid var(--s25);
border-radius: 12px;
padding: 28px 24px;
display: flex;
flex-direction: column;
align-items: center;
gap: 20px;
min-width: 260px;
flex: 1;
max-width: 380px;
min-height: 200px;
justify-content: center;
}
.demo-label {
font-family: Fraktion Mono, monospace;
font-size: 0.7rem;
color: var(--s50);
text-transform: uppercase;
letter-spacing: 0.08em;
}
.hover-btn {
background: linear-gradient(114deg, #0ae448 20%, #abff84 65%);
color: var(--black);
border: none;
padding: 12px 32px;
border-radius: 8px;
font-family: Mori, sans-serif;
font-weight: 600;
font-size: 0.9rem;
cursor: pointer;
transform-origin: center;
}
.dropdown-wrap {
position: relative;
display: inline-block;
}
.dropdown-trigger {
background: var(--s25);
color: var(--white);
border: 2px solid var(--s50);
padding: 8px 20px;
border-radius: 8px;
font-family: Mori, sans-serif;
font-size: 0.85rem;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
}
.dd-arrow {
transform-origin: center center;
display: block;
}
.dropdown-menu {
position: absolute;
top: calc(100% + 8px);
left: 50%;
transform: translateX(-50%);
background: var(--s25);
border: 2px solid var(--s50);
border-radius: 8px;
min-width: 170px;
overflow: hidden;
pointer-events: none;
visibility: hidden;
opacity: 0;
will-change: transform;
}
.dropdown-menu.open {
pointer-events: auto;
}
.dropdown-item {
will-change: transform;
padding: 9px 16px;
color: var(--s75);
font-size: 0.82rem;
cursor: pointer;
border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.dropdown-item:last-child {
border-bottom: none;
}
.dropdown-item:hover {
background: rgba(10, 228, 72, 0.08);
color: var(--white);
}
.tooltip-wrap {
position: relative;
display: inline-block;
}
.tooltip-target {
width: 48px;
height: 48px;
border-radius: 50%;
background: linear-gradient(317deg, #ffe9fe 10%, #ff96f9 83%);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
font-weight: 600;
color: var(--black);
font-size: 1.2rem;
transform-origin: center;
}
.tooltip-bubble {
position: absolute;
bottom: calc(100% + 14px);
left: 50%;
transform: translateX(-50%);
background: var(--white);
color: var(--black);
padding: 7px 16px;
border-radius: 6px;
font-size: 0.8rem;
white-space: nowrap;
pointer-events: none;
visibility: hidden;
opacity: 0;
transform-origin: bottom center;
}
.tooltip-bubble::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%);
border: 6px solid transparent;
border-top-color: var(--white);
}
함께 쓰는 파일 4개 보기
vendor/gsap-previews/sources/gsap-110595bf0a80/script.js
console.clear();
const erToggle = document.querySelector('#erToggle');
const exitSlider = document.querySelector('#exitSlider');
const exitVal = document.querySelector('#exitVal');
let exitTs = 2.5;
exitSlider.addEventListener('input', () => {
exitTs = parseFloat(exitSlider.value);
exitVal.textContent = exitTs + '×';
});
function er(val) {
return erToggle.checked ? (val || true) : false;
}
// ══════════════════════════════════════
// Button — big elastic scale
// ══════════════════════════════════════
let btnTl;
function initBtn() {
if (btnTl) { btnTl.kill(); }
gsap.set('#hoverBtn', { clearProps: 'all' });
btnTl = gsap.timeline({ paused: true })
.to('#hoverBtn', {
scale: 1.35, duration: 1.2,
ease: 'elastic.out(1.2, 0.3)',
easeReverse: er('power2.out')
}, 0);
}
initBtn();
document.querySelector('#hoverBtn').addEventListener('mouseenter', () => {
btnTl.timeScale(1).play();
});
document.querySelector('#hoverBtn').addEventListener('mouseleave', () => {
btnTl.timeScale(erToggle.checked ? exitTs : 1).reverse();
});
// ══════════════════════════════════════
// Dropdown — elastic panel, elastic arrow, stagger
// ══════════════════════════════════════
let ddOpen = false;
let ddTl;
const ddMenu = document.querySelector('#dropdownMenu');
const ddTrigger = document.querySelector('#dropdownTrigger');
const ddArrow = document.querySelector('.dd-arrow');
function initDD() {
if (ddTl) { ddTl.kill(); }
gsap.set(ddMenu, { autoAlpha: 0, yPercent: -30, scale: 0.7 });
gsap.set(ddArrow, { rotation: 0 });
gsap.set('.dropdown-item', { opacity: 1, x: 0 });
ddMenu.classList.remove('open');
ddOpen = false;
ddTl = gsap.timeline({ paused: true })
.to(ddArrow, {
rotation: 180, duration: 0.9,
ease: 'elastic.out(1.2, 0.3)',
easeReverse: er('power2.inOut')
}, 0)
.to(ddMenu, {
autoAlpha: 1, yPercent: 0, scale: 1, duration: 1,
ease: 'elastic.out(1.2, 0.3)',
easeReverse: er('power3.out')
}, 0)
.from('.dropdown-item', {
opacity: 0, x: -20, duration: 0.5,
ease: 'back.out(3)',
easeReverse: er('power2.out'),
stagger: 0.07
}, 0.1);
}
initDD();
ddTrigger.addEventListener('click', (e) => {
e.stopPropagation();
ddOpen = !ddOpen;
if (ddOpen) {
ddMenu.classList.add('open');
ddTl.timeScale(1).play();
} else {
ddTl.eventCallback('onReverseComplete', () => ddMenu.classList.remove('open'));
ddTl.timeScale(erToggle.checked ? exitTs : 1).reverse();
}
});
document.addEventListener('click', () => {
if (ddOpen) {
ddOpen = false;
ddTl.eventCallback('onReverseComplete', () => ddMenu.classList.remove('open'));
ddTl.timeScale(erToggle.checked ? exitTs : 1).reverse();
}
});
// ══════════════════════════════════════
// Tooltip — elastic pop, circle pulse
// ══════════════════════════════════════
let tipTl;
const tipBubble = document.querySelector('#tooltipBubble');
const tipWrap = document.querySelector('#tooltipWrap');
const tipTarget = document.querySelector('.tooltip-target');
function initTip() {
if (tipTl) { tipTl.kill(); }
gsap.set(tipBubble, { autoAlpha: 0, y: 14, scale: 0.4 });
gsap.set(tipTarget, { scale: 1 });
tipTl = gsap.timeline({ paused: true })
.to(tipBubble, {
autoAlpha: 1, y: 0, scale: 1, duration: 1,
ease: 'elastic.out(1.2, 0.3)',
easeReverse: er('power3.in')
}, 0)
.to(tipTarget, {
scale: 1.3, duration: 0.8,
ease: 'elastic.out(1.2, 0.3)',
easeReverse: er('power3.in')
}, 0);
}
initTip();
tipWrap.addEventListener('mouseenter', () => {
tipTl.timeScale(1).play();
});
tipWrap.addEventListener('mouseleave', () => {
tipTl.timeScale(erToggle.checked ? exitTs : 1).reverse();
});
// ══════════════════════════════════════
// Reinit on toggle
// ══════════════════════════════════════
erToggle.addEventListener('change', () => {
initBtn();
initDD();
initTip();
});vendor/gsap-previews/sources/gsap-110595bf0a80/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-110595bf0a80/adapters/script.js실행 안내·자료
window.__STYLEGALLERY_ASSETS__={};
console.clear();
const erToggle = document.querySelector("#erToggle");
const exitSlider = document.querySelector("#exitSlider");
const exitVal = document.querySelector("#exitVal");
let exitTs = 2.5;
exitSlider.addEventListener("input", () => {
exitTs = parseFloat(exitSlider.value);
exitVal.textContent = exitTs + "×";
});
function er(val) {
return erToggle.checked ? val || true : false;
}
let btnTl;
function initBtn() {
if (btnTl) {
btnTl.kill();
}
gsap.set("#hoverBtn", { clearProps: "all" });
btnTl = gsap.timeline({ paused: true }).to("#hoverBtn", {
scale: 1.35,
duration: 1.2,
ease: "elastic.out(1.2, 0.3)",
easeReverse: er("power2.out")
}, 0);
}
initBtn();
document.querySelector("#hoverBtn").addEventListener("mouseenter", () => {
btnTl.timeScale(1).play();
});
document.querySelector("#hoverBtn").addEventListener("mouseleave", () => {
btnTl.timeScale(erToggle.checked ? exitTs : 1).reverse();
});
let ddOpen = false;
let ddTl;
const ddMenu = document.querySelector("#dropdownMenu");
const ddTrigger = document.querySelector("#dropdownTrigger");
const ddArrow = document.querySelector(".dd-arrow");
function initDD() {
if (ddTl) {
ddTl.kill();
}
gsap.set(ddMenu, { autoAlpha: 0, yPercent: -30, scale: 0.7 });
gsap.set(ddArrow, { rotation: 0 });
gsap.set(".dropdown-item", { opacity: 1, x: 0 });
ddMenu.classList.remove("open");
ddOpen = false;
ddTl = gsap.timeline({ paused: true }).to(ddArrow, {
rotation: 180,
duration: 0.9,
ease: "elastic.out(1.2, 0.3)",
easeReverse: er("power2.inOut")
}, 0).to(ddMenu, {
autoAlpha: 1,
yPercent: 0,
scale: 1,
duration: 1,
ease: "elastic.out(1.2, 0.3)",
easeReverse: er("power3.out")
}, 0).from(".dropdown-item", {
opacity: 0,
x: -20,
duration: 0.5,
ease: "back.out(3)",
easeReverse: er("power2.out"),
stagger: 0.07
}, 0.1);
}
initDD();
ddTrigger.addEventListener("click", (e) => {
e.stopPropagation();
ddOpen = !ddOpen;
if (ddOpen) {
ddMenu.classList.add("open");
ddTl.timeScale(1).play();
} else {
ddTl.eventCallback("onReverseComplete", () => ddMenu.classList.remove("open"));
ddTl.timeScale(erToggle.checked ? exitTs : 1).reverse();
}
});
document.addEventListener("click", () => {
if (ddOpen) {
ddOpen = false;
ddTl.eventCallback("onReverseComplete", () => ddMenu.classList.remove("open"));
ddTl.timeScale(erToggle.checked ? exitTs : 1).reverse();
}
});
let tipTl;
const tipBubble = document.querySelector("#tooltipBubble");
const tipWrap = document.querySelector("#tooltipWrap");
const tipTarget = document.querySelector(".tooltip-target");
function initTip() {
if (tipTl) {
tipTl.kill();
}
gsap.set(tipBubble, { autoAlpha: 0, y: 14, scale: 0.4 });
gsap.set(tipTarget, { scale: 1 });
tipTl = gsap.timeline({ paused: true }).to(tipBubble, {
autoAlpha: 1,
y: 0,
scale: 1,
duration: 1,
ease: "elastic.out(1.2, 0.3)",
easeReverse: er("power3.in")
}, 0).to(tipTarget, {
scale: 1.3,
duration: 0.8,
ease: "elastic.out(1.2, 0.3)",
easeReverse: er("power3.in")
}, 0);
}
initTip();
tipWrap.addEventListener("mouseenter", () => {
tipTl.timeScale(1).play();
});
tipWrap.addEventListener("mouseleave", () => {
tipTl.timeScale(erToggle.checked ? exitTs : 1).reverse();
});
erToggle.addEventListener("change", () => {
initBtn();
initDD();
initTip();
});
LICENSE실행 안내·자료
<!--
Copyright (c) 2026 - GreenSock - https://codepen.io/GreenSock/pen/JoRZaLY
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
이 장면을 만드는 원리
역재생 곡선과 속도의 별도 입력
같은 효과를 되돌려도 퇴장 시간과 의미 상태의 변경은 별도 계약입니다.
- 이 예제에서는
- er 함수는 체크박스에 따라 easeReverse를 정하고, 마우스 퇴장에서는 timeScale을 exitTs로 바꿔 같은 타임라인을 reverse합니다. 체크박스를 바꾸면 세 효과를 kill하고 초기 상태로 재구성하므로 열려 있던 드롭다운도 닫힙니다.
