Every press tips the hand, and every release sends a '+1' floating up with a burst of lines. The pressed state snaps the pieces into place and the rest state plays them out on a transition.
Also known as: medium clap button css, plus one button animation, applause button.
<button class="btn-clap" type="button" aria-label="Clap"> <svg class="btn-clap-hand" viewBox="0 0 24 24" aria-hidden="true"><path d="M17.5 11V7.2a1.6 1.6 0 0 1 3.2 0V14a8 8 0 0 1-8 8h-1.3c-2.4 0-4-.9-5.4-2.3l-3.1-3.2a1.7 1.7 0 0 1 2.4-2.4L7.2 16V6.5a1.6 1.6 0 0 1 3.2 0V11M10.4 10.5V4.2a1.6 1.6 0 0 1 3.2 0v6.3M13.6 10.5V5.4a1.6 1.6 0 0 1 3.2 0V11"/></svg> <span class="btn-clap-lines" aria-hidden="true"><i style="--a:-50deg"></i><i style="--a:-25deg"></i><i style="--a:0deg"></i><i style="--a:25deg"></i><i style="--a:50deg"></i></span> <span class="btn-clap-plus" aria-hidden="true">+1</span> </button>
.btn-clap {
--c: var(--btn-color, #3b82f6);
position: relative;
display: grid;
place-items: center;
width: 3.4em;
height: 3.4em;
padding: 0;
border: 2px solid color-mix(in srgb, var(--c) 35%, transparent);
border-radius: 50%;
background: color-mix(in srgb, var(--c) 8%, transparent);
color: var(--c);
font: 700 var(--btn-size, 18px)/1 system-ui, sans-serif;
cursor: pointer;
-webkit-tap-highlight-color: transparent;
transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1), background-color 0.3s ease;
}
.btn-clap-hand {
width: 1.6em;
height: 1.6em;
fill: none;
stroke: currentColor;
stroke-width: 1.7;
stroke-linecap: round;
stroke-linejoin: round;
transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.btn-clap-lines i {
position: absolute;
top: 50%;
left: 50%;
width: 0.16em;
height: 0.55em;
margin: -0.275em 0 0 -0.08em;
border-radius: 0.1em;
background: var(--c);
opacity: 0;
transform: rotate(var(--a)) translateY(-2.7em) scaleY(0.6);
transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.5s cubic-bezier(0.7, 0, 0.9, 0.6);
}
.btn-clap-lines { position: absolute; inset: 0; }
.btn-clap-plus {
position: absolute;
top: -0.2em;
left: 50%;
padding: 0.3em 0.5em;
border-radius: 1em;
background: var(--c);
color: #fff;
font-size: 0.75em;
opacity: 0;
transform: translate(-50%, -2.4em);
transition: transform 0.8s cubic-bezier(0.2, 0.7, 0.3, 1), opacity 0.8s cubic-bezier(0.7, 0, 0.9, 0.6);
}
.btn-clap:active {
transform: scale(0.92);
background-color: color-mix(in srgb, var(--c) 16%, transparent);
transition-duration: 0.1s;
}
.btn-clap:active .btn-clap-hand {
transform: rotate(-14deg) scale(0.9);
transition-duration: 0.1s;
}
.btn-clap:active .btn-clap-lines i {
opacity: 1;
transform: rotate(var(--a)) translateY(-1.9em) scaleY(0);
transition: none;
}
.btn-clap:active .btn-clap-plus {
opacity: 1;
transform: translate(-50%, 0) scale(0.6);
transition: none;
}
.btn-clap:focus-visible {
outline: 2px solid var(--c);
outline-offset: 0.2em;
}
@media (prefers-reduced-motion: reduce) {
.btn-clap, .btn-clap *, .btn-clap::before, .btn-clap::after, .btn-clap *::before, .btn-clap *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--btn-color on the element or a parent.
Currently previewing #3b82f6.--btn-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 18px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.