Vissza az animációkhoz
Gombanimációk

Letöltés gomb animált

Élő előnézet – az animáció teljes méretben.

Élő előnézet
HTML · CSS · JS
HTML
<div class="we-download-stage">

    <button class="we-download-btn" id="weDownloadBtn" type="button">

        <span class="we-download-rings" aria-hidden="true">
            <span class="we-download-ring we-download-ring-one"></span>
            <span class="we-download-ring we-download-ring-two"></span>
            <span class="we-download-ring we-download-ring-three"></span>
        </span>

        <span class="we-download-core" aria-hidden="true"></span>

        <span class="we-download-arrow" aria-hidden="true">
            <span class="we-download-arrow-line"></span>
            <span class="we-download-arrow-head"></span>
        </span>

        <span class="we-download-particles" aria-hidden="true">
            <i></i>
            <i></i>
            <i></i>
            <i></i>
            <i></i>
            <i></i>
        </span>

        <span class="we-download-label">
            Letöltés
        </span>

        <span class="we-download-success">
            <span class="we-download-check">✓</span>
            <span>Letöltés kész</span>
        </span>

    </button>

</div>
CSS
.we-download-stage {
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #0b0f19;
}

.we-download-btn {
    position: relative;
    width: 260px;
    height: 78px;
    padding: 0;
    border: 1px solid rgba(95, 189, 125, .38);
    border-radius: 22px;
    overflow: hidden;
    cursor: pointer;
    isolation: isolate;
    background: linear-gradient(135deg, #18251f, #0d1511);
    color: #f4f1e9;
    font-family: Inter, system-ui, sans-serif;
    box-shadow:
        0 0 0 1px rgba(95, 189, 125, .06),
        0 18px 50px rgba(0, 0, 0, .42),
        inset 0 0 24px rgba(95, 189, 125, .035);
    transition:
        border-color .35s ease,
        box-shadow .35s ease,
        transform .25s ease;
}

.we-download-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(95, 189, 125, .72);
    box-shadow:
        0 0 25px rgba(95, 189, 125, .12),
        0 20px 55px rgba(0, 0, 0, .45);
}

.we-download-label {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 34px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .2px;
    transition:
        opacity .25s ease,
        transform .35s ease;
}

.we-download-arrow {
    position: absolute;
    z-index: 6;
    left: 43px;
    top: 50%;
    width: 24px;
    height: 30px;
    transform: translateY(-50%);
}

.we-download-arrow-line {
    position: absolute;
    left: 50%;
    top: 1px;
    width: 3px;
    height: 17px;
    border-radius: 10px;
    background: #7ac98e;
    transform: translateX(-50%);
    box-shadow: 0 0 8px rgba(122, 201, 142, .65);
}

.we-download-arrow-head {
    position: absolute;
    left: 50%;
    top: 10px;
    width: 11px;
    height: 11px;
    border-right: 3px solid #7ac98e;
    border-bottom: 3px solid #7ac98e;
    transform: translateX(-50%) rotate(45deg);
    filter: drop-shadow(0 0 4px rgba(122, 201, 142, .55));
}

.we-download-core {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ffffff;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
    box-shadow:
        0 0 12px #ffffff,
        0 0 28px #7ac98e,
        0 0 55px #3f9f63;
}

.we-download-rings {
    position: absolute;
    z-index: 2;
    left: 50%;
    top: 50%;
    width: 64px;
    height: 64px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(.4);
    pointer-events: none;
}

.we-download-ring {
    position: absolute;
    border-radius: 50%;
}

.we-download-ring-one {
    inset: 0;
    border: 2px solid rgba(122, 201, 142, .9);
    border-left-color: transparent;
    border-bottom-color: rgba(63, 159, 99, .85);
}

.we-download-ring-two {
    inset: 8px;
    border: 2px solid rgba(63, 159, 99, .9);
    border-top-color: transparent;
    border-right-color: #7ac98e;
}

.we-download-ring-three {
    inset: 18px;
    border: 1px solid rgba(244, 241, 233, .75);
    box-shadow: 0 0 12px rgba(122, 201, 142, .55);
}

.we-download-particles {
    position: absolute;
    z-index: 3;
    left: 50%;
    top: 50%;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.we-download-particles i {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #7ac98e;
    opacity: 0;
    box-shadow: 0 0 9px #7ac98e;
}

.we-download-particles i:nth-child(1) {
    --x: -74px;
    --y: -25px;
}

.we-download-particles i:nth-child(2) {
    --x: 72px;
    --y: -29px;
}

.we-download-particles i:nth-child(3) {
    --x: -88px;
    --y: 17px;
}

.we-download-particles i:nth-child(4) {
    --x: 88px;
    --y: 18px;
}

.we-download-particles i:nth-child(5) {
    --x: -48px;
    --y: 37px;
}

.we-download-particles i:nth-child(6) {
    --x: 51px;
    --y: 38px;
}

.we-download-success {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    opacity: 0;
    transform: scale(.82);
    pointer-events: none;
    transition:
        opacity .35s ease,
        transform .45s cubic-bezier(.2, .8, .2, 1.2);
}

.we-download-check {
    width: 27px;
    height: 27px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(122, 201, 142, .75);
    border-radius: 50%;
    color: #7ac98e;
    box-shadow: 0 0 15px rgba(122, 201, 142, .22);
}

.we-download-btn.is-active {
    border-color: rgba(122, 201, 142, .9);
    box-shadow:
        0 0 25px rgba(95, 189, 125, .2),
        0 0 55px rgba(63, 159, 99, .12),
        inset 0 0 30px rgba(95, 189, 125, .08);
}

.we-download-btn.is-active .we-download-label {
    opacity: 0;
    transform: translateY(-14px);
}

.we-download-btn.is-active .we-download-arrow {
    animation:
        weDownloadArrowDrop .7s cubic-bezier(.4, 0, .2, 1) forwards;
}

@keyframes weDownloadArrowDrop {
    0% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }

    65% {
        opacity: 1;
        transform: translateY(8px) scale(.8);
    }

    100% {
        opacity: 0;
        transform: translateY(18px) scale(.3);
    }
}

.we-download-btn.is-active .we-download-rings {
    animation:
        weDownloadPortalOpen 1.5s cubic-bezier(.2, .8, .2, 1) forwards;
}

@keyframes weDownloadPortalOpen {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(.3);
    }

    25% {
        opacity: 1;
    }

    70% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.65);
    }
}

.we-download-btn.is-active .we-download-ring-one {
    animation: weDownloadSpin .7s linear infinite;
}

.we-download-btn.is-active .we-download-ring-two {
    animation: weDownloadSpinReverse .55s linear infinite;
}

@keyframes weDownloadSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes weDownloadSpinReverse {
    to {
        transform: rotate(-360deg);
    }
}

.we-download-btn.is-active .we-download-core {
    animation: weDownloadCoreBurst 1.45s ease-out forwards;
}

@keyframes weDownloadCoreBurst {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }

    35% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    70% {
        opacity: .9;
        transform: translate(-50%, -50%) scale(3);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(12);
    }
}

.we-download-btn.is-active .we-download-particles i {
    animation:
        weDownloadParticleBurst .85s .55s ease-out forwards;
}

@keyframes weDownloadParticleBurst {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0);
    }

    25% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform:
            translate(var(--x), var(--y))
            scale(.2);
    }
}

.we-download-btn.is-complete .we-download-arrow,
.we-download-btn.is-complete .we-download-label,
.we-download-btn.is-complete .we-download-rings,
.we-download-btn.is-complete .we-download-core {
    opacity: 0;
}

.we-download-btn.is-complete .we-download-success {
    opacity: 1;
    transform: scale(1);
}

.we-download-btn.is-complete {
    border-color: rgba(122, 201, 142, .72);
    box-shadow:
        0 0 28px rgba(95, 189, 125, .16),
        inset 0 0 25px rgba(122, 201, 142, .05);
}
JavaScript
(function () {

    const button =
        document.getElementById("weDownloadBtn");

    if (!button) {
        return;
    }

    let running = false;

    button.addEventListener("click", function () {

        if (running) {
            return;
        }

        running = true;

        button.classList.remove("is-complete");

        button.classList.add("is-active");

        setTimeout(function () {

            button.classList.remove("is-active");

            button.classList.add("is-complete");

        }, 1550);

        setTimeout(function () {

            button.classList.remove("is-complete");

            running = false;

        }, 3600);

    });

})();