Gombanimációk
Szövegcsere
Élő előnézet – az animáció teljes méretben.
Élő előnézet
HTML · CSS · JS
<button class="we-btn-swap" type="button">
<span class="we-btn-swap-label">
<span class="we-btn-swap-front">Megnézem</span>
<span class="we-btn-swap-back">Megnyitom →</span>
</span>
</button>
.we-btn-swap {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
width: 180px;
height: 54px;
padding: 0;
border: 1px solid rgba(255,255,255,.15);
border-radius: 27px;
background: #10191c;
color: #f2f4f0;
font-family: Arial, sans-serif;
font-size: 14px;
font-weight: 500;
letter-spacing: .4px;
cursor: pointer;
overflow: hidden;
transition:
transform .45s cubic-bezier(.22,1,.36,1),
border-radius .45s ease,
border-color .4s ease,
box-shadow .45s ease;
}
.we-btn-swap-label {
position: relative;
display: block;
width: 100%;
height: 20px;
overflow: hidden;
}
.we-btn-swap-front,
.we-btn-swap-back {
position: absolute;
left: 0;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
transition:
transform .55s cubic-bezier(.22,1,.36,1),
opacity .4s ease;
}
.we-btn-swap-front {
top: 0;
transform: translateY(0);
}
.we-btn-swap-back {
top: 0;
transform: translateY(100%);
opacity: 0;
}
.we-btn-swap:hover {
transform:
translateY(-3px);
border-radius: 15px;
border-color: rgba(142,232,212,.55);
box-shadow:
0 18px 38px rgba(0,0,0,.4);
}
.we-btn-swap:hover .we-btn-swap-front {
transform: translateY(-100%);
opacity: 0;
}
.we-btn-swap:hover .we-btn-swap-back {
transform: translateY(0);
opacity: 1;
}
.we-btn-swap:active {
transform:
translateY(0)
scale(.97);
}
Ehhez az animációhoz nincs külön JavaScript.