The paper plane pulls back, shoots off the top right corner and glides back in from the bottom left. The button clips it with overflow hidden, so it leaves and returns cleanly.
Also known as: send button animation css, paper plane icon hover, send message icon.
<button class="hfx-send-icon-fly" aria-label="Send"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m22 2-7 20-4-9-9-4Z"/><path d="M22 2 11 13"/></svg></button>
.hfx-send-icon-fly {
--c: var(--hfx-color, #3b82f6);
font-size: var(--hfx-size, 16px);
position: relative;
display: grid;
place-items: center;
width: 3.5em;
height: 3.5em;
padding: 0;
border: 0;
border-radius: 50%;
cursor: pointer;
overflow: hidden;
background: var(--c);
color: #fff;
box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 0%, transparent);
transition: box-shadow 0.3s ease;}
.hfx-send-icon-fly svg {
width: 1.5em;
height: 1.5em;
transform: translate(-0.08em, 0.08em);
}
.hfx-send-icon-fly:is(:hover, :focus-visible) { box-shadow: 0 0 0 0.4em color-mix(in srgb, var(--c) 18%, transparent); }
.hfx-send-icon-fly:is(:hover, :focus-visible) svg {
animation: hfx-send-icon-fly-go 1s both;
}
@keyframes hfx-send-icon-fly-go {
0% { transform: translate(-0.08em, 0.08em) rotate(0deg); animation-timing-function: ease-out; }
18% { transform: translate(-0.3em, 0.3em) rotate(-8deg) scale(0.9); animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
48% { transform: translate(2.8em, -2.8em) rotate(0deg) scale(0.8); }
48.1% { transform: translate(-2.8em, 2.8em) rotate(0deg) scale(0.8); animation-timing-function: cubic-bezier(0.2, 0.8, 0.3, 1.15); }
100% { transform: translate(-0.08em, 0.08em) rotate(0deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
.hfx-send-icon-fly, .hfx-send-icon-fly *, .hfx-send-icon-fly::before, .hfx-send-icon-fly::after, .hfx-send-icon-fly *::before, .hfx-send-icon-fly *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--hfx-color on the element or a parent.
Currently previewing #3b82f6.--hfx-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 16px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.