Skip to content

Flying Envelope

Click to launch an envelope with flapping wings that flies away, then turns green with a sent confirmation

Flying Envelope

by FreeCsStyles Dev's

StatefulFly Away
🌐🎨⚛️💚🅰️🔥☁️
#envelope#send#fly#wings#flap#mail#dispatch

Embed this component

Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/flying-envelope-button.

<iframe src="/embed/flying-envelope-button" sandbox="allow-scripts" loading="lazy" title="Flying Envelope" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>

Implementation code

Copy the HTML and CSS for Flying Envelope, or grab a framework-specific implementation. The HTML and CSS variants are self-contained; framework variants assume that framework's project setup.

HTML
<button class="btn-envelope" id="envBtn" onclick="triggerEnvelope()" style="display:flex;align-items:center;justify-content:center;gap:6px">
  <div class="env-wrapper" style="display:flex;align-items:center;gap:2px">
    <span class="wing left" style="font-size:10px">👈</span>
    <span class="icon" style="font-size:18px">✉️</span>
    <span class="wing right" style="font-size:10px">👉</span>
  </div>
  <span class="text">Send</span>
</button>
<script>
function triggerEnvelope() {
  const btn=document.getElementById('envBtn');
  if(btn.classList.contains('is-sending')) return;
  btn.classList.add('is-sending');
  setTimeout(()=>{btn.classList.remove('is-sending');btn.classList.add('is-sent');btn.querySelector('.text').innerText='Sent ✓';},1500);
  setTimeout(()=>{btn.classList.remove('is-sent');btn.querySelector('.text').innerText='Send';},5000);
}
</script>
CSS
.btn-envelope{width:160px;height:50px;border-radius:12px;border:none;background:#e11d48;color:#fff;font-size:16px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:6px;overflow:visible;transition:all .4s cubic-bezier(.4,0,.2,1);box-shadow:0 4px 15px rgba(225,29,72,.4);font-family:system-ui,sans-serif}.btn-envelope .env-wrapper{display:flex;align-items:center;gap:2px}.btn-envelope .wing{font-size:10px;display:inline-block}.btn-envelope.is-sending .text{opacity:0}.btn-envelope.is-sending .env-wrapper{animation:fly-envelope 1.5s forwards cubic-bezier(.5,0,.2,1)}.btn-envelope.is-sending .wing{animation:flap .2s infinite alternate}.btn-envelope.is-sent{background:#16a34a}.btn-envelope.is-sent .env-wrapper{display:none}@keyframes flap{0%{transform:rotateY(0deg) translateY(0)}100%{transform:rotateY(60deg) translateY(-2px)}}@keyframes fly-envelope{0%{transform:translate(0,0) scale(1)}20%{transform:translate(-10px,0) scale(1)}100%{transform:translate(140px,-40px) scale(.4);opacity:0}}
Tailwind CSS
<button class="w-[160px] h-[50px] rounded-xl border-none bg-rose-600 text-white text-base font-bold cursor-pointer flex items-center justify-center gap-1.5 overflow-visible transition-all duration-400 shadow-[0_4px_15px_rgba(225,29,72,0.4)] [&.is-sending_.env-wrapper]:animate-[fly-envelope-tw_1.5s_forwards_cubic-bezier(0.5,0,0.2,1)] [&.is-sending_.wing]:animate-[flap-tw_0.2s_infinite_alternate] [&.is-sending_.text]:opacity-0 [&.is-sent]:bg-green-600 [&.is-sent_.env-wrapper]:hidden [&.is-sent]:shadow-[0_4px_15px_rgba(22,163,74,0.4)]" id="tw-env">
  <span class="env-wrapper flex items-center gap-0.5">
    <span class="wing text-[10px] inline-block">👈</span>
    <span class="icon text-lg">✉️</span>
    <span class="wing text-[10px] inline-block">👉</span>
  </span>
  <span class="text">Send</span>
</button>
React
import React from 'react';
import { motion } from 'framer-motion';

function FlyingEnvelopeButton() {
  const [state, setState] = React.useState('idle');
  const handleClick = () => {
    if (state !== 'idle') return;
    setState('sending');
    setTimeout(() => setState('sent'), 1500);
    setTimeout(() => setState('idle'), 5000);
  };
  const se = state === 'sending';
  const st = state === 'sent';
  return (
    <motion.button onClick={handleClick}
      style={{ width: 160, height: 50, borderRadius: 12, border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', gap: 6, fontSize: 16, fontWeight: 700, color: '#fff', background: st ? '#16a34a' : '#e11d48', boxShadow: st ? '0 4px 15px rgba(22,163,74,0.4)' : '0 4px 15px rgba(225,29,72,0.4)', transition: 'all 0.4s cubic-bezier(0.4,0,0.2,1)', overflow: 'visible', fontFamily: 'system-ui, sans-serif' }}
      whileTap={state === 'idle' ? { scale: 0.95 } : {}} disabled={state !== 'idle'}>
      <motion.span style={{ display: 'inline-flex', alignItems: 'center', gap: 2 }}
        animate={se ? { x: [0,-10,140], y: [0,0,-40], scale: [1,1,0.4], opacity: [1,1,0], transition: { duration: 1.5, ease: [0.5,0,0.2,1] } } : st ? { opacity: 0, width: 0, height: 0 } : { x: 0, y: 0, scale: 1, opacity: 1 }}>
        <motion.span style={{ fontSize: 10, display: 'inline-block' }} animate={se ? { rotateY: [0,60,0], y: [0,-2,0], transition: { duration: 0.2, repeat: Infinity } } : {}}>👈</motion.span>
        <span style={{ fontSize: 18 }}>✉️</span>
        <motion.span style={{ fontSize: 10, display: 'inline-block' }} animate={se ? { rotateY: [0,-60,0], y: [0,-2,0], transition: { duration: 0.2, repeat: Infinity } } : {}}>👉</motion.span>
      </motion.span>
      <motion.span style={{ marginLeft: 6 }} animate={se ? { opacity: 0 } : { opacity: 1 }}>{st ? 'Sent ✓' : 'Send'}</motion.span>
    </motion.button>
  );
}
Vue
<template>
  <button class="btn-envelope" :class="{'is-sending':state==='sending','is-sent':state==='sent'}" @click="handleClick" :disabled="state!=='idle'">
    <span class="env-wrapper" style="display:inline-flex;align-items:center;gap:2px">
      <span class="wing" style="font-size:10px">👈</span>
      <span class="icon" style="font-size:18px">✉️</span>
      <span class="wing" style="font-size:10px">👉</span>
    </span>
    <span class="text" style="margin-left:6px">{{ state==='sent' ? 'Sent ✓' : 'Send' }}</span>
  </button>
</template>
<script setup>
import { ref } from 'vue';
const state = ref('idle');
function handleClick() {
  if (state.value !== 'idle') return;
  state.value = 'sending';
  setTimeout(() => state.value = 'sent', 1500);
  setTimeout(() => state.value = 'idle', 5000);
}
</script>
<style scoped>
.btn-envelope{width:160px;height:50px;border-radius:12px;border:none;background:#e11d48;color:#fff;font-size:16px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:6px;overflow:visible;transition:all .4s cubic-bezier(.4,0,.2,1);box-shadow:0 4px 15px rgba(225,29,72,.4)}.btn-envelope .wing{font-size:10px;display:inline-block}.btn-envelope.is-sending .text{opacity:0}.btn-envelope.is-sending .wing{animation:flap .2s infinite alternate}.btn-envelope.is-sending .env-wrapper{animation:fly-envelope 1.5s forwards cubic-bezier(.5,0,.2,1)}.btn-envelope.is-sent{background:#16a34a}.btn-envelope.is-sent .env-wrapper{display:none}@keyframes flap{0%{transform:rotateY(0deg) translateY(0)}100%{transform:rotateY(60deg) translateY(-2px)}}@keyframes fly-envelope{0%{transform:translate(0,0) scale(1)}20%{transform:translate(-10px,0) scale(1)}100%{transform:translate(140px,-40px) scale(.4);opacity:0}}
</style>
Svelte
<script>
  let state = 'idle';
  function handleClick() {
    if (state !== 'idle') return;
    state = 'sending';
    setTimeout(() => state = 'sent', 1500);
    setTimeout(() => state = 'idle', 5000);
  }
</script>
<button class="btn-envelope" class:is-sending={state==='sending'} class:is-sent={state==='sent'} on:click={handleClick} disabled={state!=='idle'}>
  <span class="env-wrapper" style="display:inline-flex;align-items:center;gap:2px">
    <span class="wing" style="font-size:10px">👈</span>
    <span class="icon" style="font-size:18px">✉️</span>
    <span class="wing" style="font-size:10px">👉</span>
  </span>
  <span class="text" style="margin-left:6px">{state==='sent' ? 'Sent ✓' : 'Send'}</span>
</button>
<style>
.btn-envelope{width:160px;height:50px;border-radius:12px;border:none;background:#e11d48;color:#fff;font-size:16px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:6px;overflow:visible;transition:all .4s cubic-bezier(.4,0,.2,1);box-shadow:0 4px 15px rgba(225,29,72,.4)}.btn-envelope .wing{font-size:10px;display:inline-block}.btn-envelope.is-sending .text{opacity:0}.btn-envelope.is-sending .wing{animation:flap .2s infinite alternate}.btn-envelope.is-sending .env-wrapper{animation:fly-envelope 1.5s forwards cubic-bezier(.5,0,.2,1)}.btn-envelope.is-sent{background:#16a34a}.btn-envelope.is-sent .env-wrapper{display:none}@keyframes flap{0%{transform:rotateY(0deg) translateY(0)}100%{transform:rotateY(60deg) translateY(-2px)}}@keyframes fly-envelope{0%{transform:translate(0,0) scale(1)}20%{transform:translate(-10px,0) scale(1)}100%{transform:translate(140px,-40px) scale(.4);opacity:0}}
</style>
Angular
import { Component } from '@angular/core';
@Component({
  selector: 'app-flying-envelope-button',
  template: `<button class="btn-envelope" [class.is-sending]="state==='sending'" [class.is-sent]="state==='sent'" (click)="handleClick()" [disabled]="state!=='idle'">
    <span class="env-wrapper" style="display:inline-flex;align-items:center;gap:2px">
      <span class="wing" style="font-size:10px">👈</span>
      <span class="icon" style="font-size:18px">✉️</span>
      <span class="wing" style="font-size:10px">👉</span>
    </span>
    <span class="text" style="margin-left:6px">{{ state==='sent' ? 'Sent ✓' : 'Send' }}</span>
  </button>`,
  styles: [`.btn-envelope{width:160px;height:50px;border-radius:12px;border:none;background:#e11d48;color:#fff;font-size:16px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:6px;overflow:visible;transition:all .4s cubic-bezier(.4,0,.2,1);box-shadow:0 4px 15px rgba(225,29,72,.4)}.btn-envelope .wing{font-size:10px;display:inline-block}.btn-envelope.is-sending .text{opacity:0}.btn-envelope.is-sending .wing{animation:flap .2s infinite alternate}.btn-envelope.is-sending .env-wrapper{animation:fly-envelope 1.5s forwards cubic-bezier(.5,0,.2,1)}.btn-envelope.is-sent{background:#16a34a}.btn-envelope.is-sent .env-wrapper{display:none}@keyframes flap{0%{transform:rotateY(0deg) translateY(0)}100%{transform:rotateY(60deg) translateY(-2px)}}@keyframes fly-envelope{0%{transform:translate(0,0) scale(1)}20%{transform:translate(-10px,0) scale(1)}100%{transform:translate(140px,-40px) scale(.4);opacity:0}}`]
})
export class FlyingEnvelopeButtonComponent { state='idle';handleClick(){if(this.state!=='idle')return;this.state='sending';setTimeout(()=>this.state='sent',1500);setTimeout(()=>this.state='idle',5000);}}
LWC — HTML template
<template><button class="btn-envelope" onclick={handleClick} disabled={disabled}>
  <span class="env-wrapper" style="display:inline-flex;align-items:center;gap:2px">
    <span class="wing" style="font-size:10px">👈</span>
    <span class="icon" style="font-size:18px">✉️</span>
    <span class="wing" style="font-size:10px">👉</span>
  </span>
  <span class="text" style="margin-left:6px">{label}</span>
</button></template>
LWC — JavaScript
import { LightningElement } from 'lwc';
export default class FlyingEnvelopeButton extends LightningElement {
  state = 'idle';
  get disabled() { return this.state !== 'idle'; }
  get label() { return this.state==='sent' ? 'Sent ✓' : 'Send'; }
  handleClick() {
    if (this.state !== 'idle') return;
    this.state = 'sending';
    const btn = this.template.querySelector('button');
    btn.classList.add('is-sending');
    setTimeout(()=>{btn.classList.remove('is-sending');btn.classList.add('is-sent');this.state='sent';},1500);
    setTimeout(()=>{btn.classList.remove('is-sent');this.state='idle';},5000);
  }
}
LWC — CSS
.btn-envelope{width:160px;height:50px;border-radius:12px;border:none;background:#e11d48;color:#fff;font-size:16px;font-weight:700;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:6px;overflow:visible;transition:all .4s cubic-bezier(.4,0,.2,1);box-shadow:0 4px 15px rgba(225,29,72,.4)}.btn-envelope .wing{font-size:10px;display:inline-block}.btn-envelope.is-sending .text{opacity:0}.btn-envelope.is-sending .wing{animation:flap .2s infinite alternate}.btn-envelope.is-sending .env-wrapper{animation:fly-envelope 1.5s forwards cubic-bezier(.5,0,.2,1)}.btn-envelope.is-sent{background:#16a34a}.btn-envelope.is-sent .env-wrapper{display:none}@keyframes flap{0%{transform:rotateY(0deg) translateY(0)}100%{transform:rotateY(60deg) translateY(-2px)}}@keyframes fly-envelope{0%{transform:translate(0,0) scale(1)}20%{transform:translate(-10px,0) scale(1)}100%{transform:translate(140px,-40px) scale(.4);opacity:0}}
LWC — Configuration
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
  <apiVersion>59.0</apiVersion>
  <isExposed>true</isExposed>
  <targets><target>lightning__AppPage</target><target>lightning__RecordPage</target><target>lightning__HomePage</target></targets>
</LightningComponentBundle>

Where Flying Envelope fits

  • Send
  • Email
  • Message
  • Dispatch
  • Notify

Interaction states & animations

  • Wing Flap
  • Fly Away
  • Pull Back
  • Sent Confirm

Topics

  • #envelope
  • #send
  • #fly
  • #wings
  • #flap
  • #mail
  • #dispatch

Accessibility notes

Wing flap and fly-away are decorative. Announce state changes via aria-live.

Browser support

  • All modern browsers