Gombok és CTA
Animált belépés gomb
Élő előnézet – a komponens teljes méretben.
Élő előnézet
HTML · CSS · JS
<div class="we-login-stage">
<button
class="we-login-btn"
id="weLoginBtn"
type="button"
>
<span class="we-login-label">
Bejelentkezés
</span>
<span
class="we-login-animation"
aria-hidden="true"
>
<span class="we-login-track">
<span></span>
<span></span>
<span></span>
</span>
<span class="we-lock">
<span class="we-lock-shackle"></span>
<span class="we-lock-body">
<span class="we-keyhole"></span>
</span>
</span>
</span>
<span
class="we-login-success"
aria-hidden="true"
>
<span class="we-success-icon">
<svg viewBox="0 0 24 24">
<path d="M5 12.5l4.2 4.2L19 7"></path>
</svg>
</span>
<span class="we-success-text">
Sikeres belépés
</span>
</span>
</button>
</div>
.we-login-stage {
min-height: 260px;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
background:
radial-gradient(
circle at 50% 45%,
rgba(46, 204, 113, 0.14),
transparent 36%
),
#080d15;
}
.we-login-btn {
position: relative;
width: 220px;
height: 66px;
padding: 0;
border: 1px solid rgba(46, 204, 113, 0.35);
border-radius: 18px;
background:
linear-gradient(
135deg,
#14251f,
#0b1512
);
color: #ffffff;
font-family: Arial, sans-serif;
cursor: pointer;
overflow: hidden;
box-shadow:
0 12px 30px rgba(0, 0, 0, 0.28),
inset 0 1px 0 rgba(255, 255, 255, 0.08);
transition:
border-color 0.3s ease,
box-shadow 0.3s ease,
transform 0.3s ease;
}
.we-login-btn:hover {
border-color: rgba(46, 204, 113, 0.75);
box-shadow:
0 16px 38px rgba(46, 204, 113, 0.12),
inset 0 1px 0 rgba(255, 255, 255, 0.10);
transform: translateY(-2px);
}
.we-login-label {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 17px;
font-weight: 700;
transition:
opacity 0.25s ease,
transform 0.35s ease;
}
.we-login-btn.we-running .we-login-label {
opacity: 0;
transform:
translateY(-14px)
scale(0.92);
}
.we-login-animation {
position: absolute;
inset: 0;
opacity: 0;
pointer-events: none;
transition: opacity 0.2s ease;
}
.we-login-btn.we-driving .we-login-animation {
opacity: 1;
}
.we-login-track {
position: absolute;
left: 22px;
right: 22px;
bottom: 12px;
height: 2px;
overflow: hidden;
background: rgba(46, 204, 113, 0.10);
}
.we-login-track span {
position: absolute;
top: 0;
width: 28px;
height: 2px;
border-radius: 20px;
background:
linear-gradient(
90deg,
transparent,
#2ecc71
);
}
.we-login-track span:nth-child(1) {
left: 10px;
}
.we-login-track span:nth-child(2) {
left: 82px;
}
.we-login-track span:nth-child(3) {
left: 154px;
}
.we-login-btn.we-driving
.we-login-track span {
animation:
we-track-move
0.7s linear infinite;
}
@keyframes we-track-move {
from {
transform: translateX(45px);
}
to {
transform: translateX(-70px);
}
}
.we-lock {
position: absolute;
left: calc(50% - 20px);
top: 14px;
width: 40px;
height: 40px;
animation:
we-lock-enter
0.75s
cubic-bezier(.45, 0, .25, 1)
forwards;
}
.we-login-btn.we-driving .we-lock {
animation:
we-lock-pulse
1.15s
ease-in-out
infinite alternate;
}
@keyframes we-lock-enter {
0% {
transform:
translateX(-95px)
scale(0.7);
opacity: 0;
}
100% {
transform:
translateX(0)
scale(1);
opacity: 1;
}
}
@keyframes we-lock-pulse {
from {
filter:
drop-shadow(
0 0 0 rgba(46, 204, 113, 0)
);
}
to {
filter:
drop-shadow(
0 0 10px rgba(46, 204, 113, 0.45)
);
}
}
.we-lock-body {
position: absolute;
left: 5px;
bottom: 2px;
width: 30px;
height: 25px;
border-radius: 7px;
border: 2px solid #2ecc71;
background:
linear-gradient(
135deg,
#173b2b,
#0c1e16
);
box-shadow:
inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.we-lock-shackle {
position: absolute;
left: 11px;
top: 1px;
width: 18px;
height: 20px;
border:
3px solid #2ecc71;
border-bottom: 0;
border-radius:
12px 12px 0 0;
transform-origin:
right bottom;
transition:
transform 0.45s ease;
}
.we-login-btn.we-driving
.we-lock-shackle {
transform:
rotate(24deg)
translateX(4px);
}
.we-keyhole {
position: absolute;
left: 50%;
top: 7px;
width: 7px;
height: 7px;
border-radius: 50%;
background: #2ecc71;
transform:
translateX(-50%);
}
.we-keyhole::after {
content: "";
position: absolute;
left: 2px;
top: 5px;
width: 3px;
height: 8px;
border-radius: 2px;
background: #2ecc71;
}
.we-login-success {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
gap: 9px;
opacity: 0;
transform:
translateY(10px)
scale(0.95);
transition:
opacity 0.35s ease,
transform 0.35s ease;
}
.we-login-btn.we-success
.we-login-success {
opacity: 1;
transform:
translateY(0)
scale(1);
}
.we-success-icon {
width: 27px;
height: 27px;
display: flex;
align-items: center;
justify-content: center;
border:
1px solid
rgba(46, 204, 113, 0.7);
border-radius: 50%;
color: #2ecc71;
box-shadow:
0 0 14px rgba(46, 204, 113, 0.16);
}
.we-success-icon svg {
width: 16px;
height: 16px;
fill: none;
stroke: currentColor;
stroke-width: 2.5;
stroke-linecap: round;
stroke-linejoin: round;
}
.we-success-text {
font-size: 15px;
font-weight: 700;
color: #ffffff;
}
.we-login-btn.we-success {
border-color:
rgba(46, 204, 113, 0.65);
}
(function () {
const button = document.getElementById("weLoginBtn");
if (!button) {
return;
}
let running = false;
button.addEventListener("click", function () {
if (running) {
return;
}
if (button.classList.contains("we-success")) {
button.classList.remove("we-success");
button.classList.remove("we-driving");
button.classList.remove("we-running");
return;
}
running = true;
button.classList.add("we-running");
setTimeout(function () {
button.classList.add("we-driving");
}, 260);
setTimeout(function () {
button.classList.remove("we-driving");
button.classList.add("we-success");
}, 2200);
setTimeout(function () {
running = false;
}, 2800);
});
})();