<button class="favorite-button">
    <div class="icon">
        <div class="star"></div>
    </div>
    <span>Favorite</span>
</button>

<!-- dribbble - twitter -->
<a class="dribbble" href="https://dribbble.com/ai" target="_blank"><img src="https://cdn.dribbble.com/assets/dribbble-ball-mark-2bd45f09c2fb58dbbfb44766d5d1d07c5a12972d602ef8b32204d28fa3dda554.svg" alt=""></a>
<a class="twitter" target="_blank" href="https://twitter.com/aaroniker_me"><svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" viewBox="0 0 72 72"><path d="M67.812 16.141a26.246 26.246 0 0 1-7.519 2.06 13.134 13.134 0 0 0 5.756-7.244 26.127 26.127 0 0 1-8.313 3.176A13.075 13.075 0 0 0 48.182 10c-7.229 0-13.092 5.861-13.092 13.093 0 1.026.118 2.021.338 2.981-10.885-.548-20.528-5.757-26.987-13.679a13.048 13.048 0 0 0-1.771 6.581c0 4.542 2.312 8.551 5.824 10.898a13.048 13.048 0 0 1-5.93-1.638c-.002.055-.002.11-.002.162 0 6.345 4.513 11.638 10.504 12.84a13.177 13.177 0 0 1-3.449.457c-.846 0-1.667-.078-2.465-.231 1.667 5.2 6.499 8.986 12.23 9.09a26.276 26.276 0 0 1-16.26 5.606A26.21 26.21 0 0 1 4 55.976a37.036 37.036 0 0 0 20.067 5.882c24.083 0 37.251-19.949 37.251-37.249 0-.566-.014-1.134-.039-1.694a26.597 26.597 0 0 0 6.533-6.774z"></path></svg></a>
.favorite-button {
    --background-default: #313440;
    --text-color-default: #FAFBFF;
    --star-color-default: #62677C;
    --star-face-color-default: #1F2128;
    --star-color-active: #F6C206;
    --star-face-color-active: #845901;
    --star-hole: #16181E;
    --star-hole-inner: #20232C;
    --button-y: 0px;
    --star-y: 0px;
    --star-scale: 1;
    --star-rotate: 0deg;
    --star-hole-scale: 0;
    --star-face-scale: 1;
    --text-x: 0px;
    --text-o: 1;
    -webkit-tap-highlight-color: transparent;
    -webkit-appearance: none;
    outline: none;
    border: none;
    background: none;
    min-width: 125px;
    padding: 12px 24px 12px 16px;
    margin: 0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 19px;
    display: flex;
    align-items: center;
    cursor: pointer;
    position: relative;
    color: var(--text-color-default);
    transform: translateY(var(--button-y)) translateZ(0);
    &:before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        border-radius: 9px;
        transition: transform .2s;
        transform: scale(var(--background-scale-x, 1), var(--background-scale-y, 1)) translateZ(0);
        background: var(--background-default);
    }
    &:active {
        --background-scale-x: .98;
        --background-scale-y: .96;
    }
    span {
        display: block;
        opacity: var(--text-o);
        transform: translateX(var(--text-x));
    }
    .icon {
        width: 36px;
        height: 119px;
        display: flex;
        pointer-events: none;
        position: relative;
        clip-path: ellipse(150% 50% at 50% 50%);
        margin: -100px 2px 0 -8px;
        &:before {
            content: '';
            margin-top: auto;
            display: block;
            width: 36px;
            height: 12px;
            background: var(--star-hole);
            box-shadow: inset 0 3px 0 0 var(--star-hole-inner);
            border-radius: 100px / 30px;
            transform: scale(var(--star-hole-scale));
            transform-origin: 50% 100%;
        }
        .star {
            width: 20px;
            height: 19px;
            position: absolute;
            left: 8px;
            bottom: 0;
            transform: translateY(var(--star-y)) rotate(var(--star-rotate)) scale(var(--star-scale));
            border-radius: var(--star-radius, 0px);
            background: var(--star-color, var(--star-color-default));
            clip-path: var(--star-clip, polygon(10px 0, 13px 6px, 20px 7px, 15px 12px, 16px 19px, 10px 15px, 4px 19px, 5px 12px, 0 7px, 7px 6px));
            transition: clip-path .2s, border-radius .2s, background .2s;
            &:before,
            &:after {
                content: '';
                position: absolute;
                background: var(--star-face-color, var(--star-face-color-default));
                transition: background .2s, box-shadow .2s;
            }
            &:before {
                width: 2px;
                height: 2px;
                border-radius: 50%;
                left: 7px;
                top: 8px;
                box-shadow: 4px 0 0 0 var(--star-face-color, var(--star-face-color-default));
                transform: scaleY(var(--star-face-scale));
            }
            &:after {
                width: 4px;
                height: 2px;
                border-radius: var(--star-face-radius, 2px 2px 0 0);
                left: 8px;
                top: 11px;
                transition: border-radius .2s;
            }
        }
    }
    &.star-round {
        --star-clip: polygon(10px 0, 20px 0, 20px 7px, 20px 12px, 20px 19px, 10px 19px, 0 19px, 0 12px, 0 7px, 0 0);
        --star-radius: 50%;
    }
    &.active {
        --star-color: var(--star-color-active);
        --star-face-color: var(--star-face-color-active);
        --star-face-radius: 0 0 2px 2px;
    }
}

html {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

* {
    box-sizing: inherit;
    &:before,
    &:after {
        box-sizing: inherit;
    }
}

// Center & dribbble
body {
    min-height: 100vh;
    display: flex;
    font-family: 'Inter', Arial;
    justify-content: center;
    align-items: center;
    background: #F6F8FF;
    .dribbble {
        position: fixed;
        display: block;
        right: 20px;
        bottom: 20px;
        img {
            display: block;
            height: 28px;
        }
    }
    .twitter {
        position: fixed;
        display: block;
        right: 64px;
        bottom: 14px;
        svg {
            width: 32px;
            height: 32px;
            fill: #1da1f2;
        }
    }
}
View Compiled
document.querySelectorAll('.favorite-button').forEach(button => {
    button.addEventListener('click', e => {
        e.preventDefault()

        if(button.classList.contains('animated')) {
            return
        }
        button.classList.add('animated')

        gsap.to(button, {
            keyframes: [{
                '--star-y': '-36px',
                duration: .3,
                ease: 'power2.out'
            }, {
                '--star-y': '48px',
                '--star-scale': .4,
                duration: .325,
                onStart() {
                    button.classList.add('star-round')
                }
            }, {
                '--star-y': '-64px',
                '--star-scale': 1,
                duration: .45,
                ease: 'power2.out',
                onStart() {
                    button.classList.toggle('active')
                    setTimeout(() => button.classList.remove('star-round'), 100)
                }
            }, {
                '--star-y': '0px',
                duration: .45,
                ease: 'power2.in'
            }, {
                '--button-y': '3px',
                duration: .11
            }, {
                '--button-y': '0px',
                '--star-face-scale': .65,
                duration: .125
            }, {
                '--star-face-scale': 1,
                duration: .15
            }],
            clearProps: true,
            onComplete() {
                button.classList.remove('animated')
            }
        })

        gsap.to(button, {
            keyframes: [{
                '--star-hole-scale': .8,
                duration: .5,
                ease: 'elastic.out(1, .75)'
            }, {
                '--star-hole-scale': 0,
                duration: .2,
                delay: .2
            }]
        })

        gsap.to(button, {
            '--star-rotate': '360deg',
            duration: 1.55,
            clearProps: true
        })
    })
})

External CSS

  1. https://fonts.googleapis.com/css?family=Inter:400,500,600,700&amp;display=swap

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/gsap/3.4.0/gsap.min.js