Drone Delivery
Click to dispatch a drone that descends, picks up a package, and flies away into the sky
Embed this component
Paste this snippet into any site — the design renders in a sandboxed iframe served from /embed/drone-delivery-button.
<iframe src="/embed/drone-delivery-button" sandbox="allow-scripts" loading="lazy" title="Drone Delivery" style="border:0;width:100%;height:480px;overflow:hidden"></iframe>Implementation code
Copy the HTML and CSS for Drone Delivery, 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-drone" id="droneBtn" onclick="triggerDrone()">
<span class="drone" style="position:absolute;top:-30px;left:65px;font-size:24px">🚁</span>
<span class="package" style="position:absolute;bottom:-30px;left:70px;font-size:16px">📦</span>
<span class="text" style="position:relative">Deliver</span>
</button>
<script>
function triggerDrone(){const btn=document.getElementById('droneBtn');if(btn.classList.contains('is-active'))return;btn.classList.add('is-active','is-arriving');setTimeout(()=>{btn.classList.remove('is-arriving');btn.classList.add('is-flying');},1200);setTimeout(()=>{btn.classList.add('is-delivered');btn.querySelector('.text').innerText='Delivered';},2200);setTimeout(()=>{btn.classList.remove('is-active','is-flying','is-delivered');btn.querySelector('.text').innerText='Deliver';},5000);}
</script>CSS
.btn-drone{width:160px;height:50px;border-radius:12px;border:none;background:#0284c7;color:#fff;font-size:16px;font-weight:700;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:all .4s cubic-bezier(.4,0,.2,1);font-family:system-ui,sans-serif}.btn-drone .drone{position:absolute;top:-30px;left:65px;font-size:24px;transition:all 1s ease-in-out}.btn-drone .package{position:absolute;bottom:-30px;left:70px;font-size:16px;transition:all 1s ease-in-out}.btn-drone .text{transition:.3s}.btn-drone.is-active .text{opacity:0}.btn-drone.is-arriving .drone{top:10px}.btn-drone.is-arriving .package{bottom:0}.btn-drone.is-flying .drone,.btn-drone.is-flying .package{transform:translate(100px,-60px) scale(.5)}.btn-drone.is-delivered{background:#10b981}Tailwind CSS
<button class="w-[160px] h-[50px] rounded-xl border-none bg-sky-600 text-white text-base font-bold cursor-pointer relative flex items-center justify-center overflow-hidden transition-all duration-400 [&.is-arriving_.drone]:top-[10px] [&.is-arriving_.package]:bottom-0 [&.is-flying_.drone]:translate-x-[100px] [&.is-flying_.drone]:-translate-y-[60px] [&.is-flying_.drone]:scale-50 [&.is-flying_.package]:translate-x-[100px] [&.is-flying_.package]:-translate-y-[60px] [&.is-flying_.package]:scale-50 [&.is-delivered]:bg-emerald-600" id="tw-drone">
<span class="drone" style="position:absolute;top:-30px;left:65px;font-size:24px;transition:all 1s ease-in-out">🚁</span>
<span class="package" style="position:absolute;bottom:-30px;left:70px;font-size:16px;transition:all 1s ease-in-out">📦</span>
<span class="text" style="position:relative">Deliver</span>
</button>React
import React from 'react';
import { motion } from 'framer-motion';
function DroneDeliveryButton() {
const [state, setState] = React.useState('idle');
const handleClick = () => {
if (state !== 'idle') return;
setState('arriving');
setTimeout(() => setState('flying'), 1200);
setTimeout(() => setState('delivered'), 2200);
setTimeout(() => setState('idle'), 5000);
};
const a=state==='arriving', f=state==='flying', d=state==='delivered';
return (
<motion.button onClick={handleClick}
style={{ width: 160, height: 50, borderRadius: 12, border: 'none', cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center', position: 'relative', fontSize: 16, fontWeight: 700, color: '#fff', background: d ? '#10b981' : '#0284c7', overflow: 'hidden', fontFamily: 'system-ui, sans-serif', transition: 'all 0.4s cubic-bezier(0.4,0,0.2,1)' }}
whileTap={state === 'idle' ? { scale: 0.95 } : {}} disabled={state !== 'idle'}>
<motion.span style={{ position: 'absolute', top: a||f ? 10 : -30, left: 65, fontSize: 24 }}
animate={f ? { x: 100, y: -60, scale: 0.5 } : {}}>🚁</motion.span>
<motion.span style={{ position: 'absolute', bottom: a||f ? 0 : -30, left: 70, fontSize: 16 }}
animate={f ? { x: 100, y: -60, scale: 0.5 } : {}}>📦</motion.span>
<motion.span style={{ position: 'relative' }} animate={state!=='idle' ? { opacity: 0 } : {}}>Deliver</motion.span>
<motion.span style={{ position: 'absolute' }} animate={d ? { opacity: 1 } : {}}>Delivered</motion.span>
</motion.button>
);
}Vue
<template>
<button class="btn-drone" :class="{'is-arriving':state==='arriving','is-flying':state==='flying','is-delivered':state==='delivered'}" @click="handleClick" :disabled="state!=='idle'">
<span class="drone" style="position:absolute;top:-30px;left:65px;font-size:24px">🚁</span>
<span class="package" style="position:absolute;bottom:-30px;left:70px;font-size:16px">📦</span>
<span class="text" style="position:relative">{{ state==='delivered' ? 'Delivered' : 'Deliver' }}</span>
</button>
</template>
<script setup>
import { ref } from 'vue';
const state = ref('idle');
function handleClick() {
if (state.value !== 'idle') return;
state.value = 'arriving';
setTimeout(() => state.value = 'flying', 1200);
setTimeout(() => state.value = 'delivered', 2200);
setTimeout(() => state.value = 'idle', 5000);
}
</script>
<style scoped>
.btn-drone{width:160px;height:50px;border-radius:12px;border:none;background:#0284c7;color:#fff;font-size:16px;font-weight:700;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:all .4s cubic-bezier(.4,0,.2,1)}.btn-drone .drone{position:absolute;top:-30px;left:65px;font-size:24px;transition:all 1s ease-in-out}.btn-drone .package{position:absolute;bottom:-30px;left:70px;font-size:16px;transition:all 1s ease-in-out}.btn-drone .text{transition:.3s}.btn-drone.is-active .text{opacity:0}.btn-drone.is-arriving .drone{top:10px}.btn-drone.is-arriving .package{bottom:0}.btn-drone.is-flying .drone,.btn-drone.is-flying .package{transform:translate(100px,-60px) scale(.5)}.btn-drone.is-delivered{background:#10b981}
</style>Svelte
<script>
let state = 'idle';
function handleClick() {
if (state !== 'idle') return;
state = 'arriving';
setTimeout(() => state = 'flying', 1200);
setTimeout(() => state = 'delivered', 2200);
setTimeout(() => state = 'idle', 5000);
}
</script>
<button class="btn-drone" class:is-arriving={state==='arriving'} class:is-flying={state==='flying'} class:is-delivered={state==='delivered'} on:click={handleClick} disabled={state!=='idle'}>
<span class="drone" style="position:absolute;top:-30px;left:65px;font-size:24px">🚁</span>
<span class="package" style="position:absolute;bottom:-30px;left:70px;font-size:16px">📦</span>
<span class="text" style="position:relative">{state==='delivered' ? 'Delivered' : 'Deliver'}</span>
</button>
<style>
.btn-drone{width:160px;height:50px;border-radius:12px;border:none;background:#0284c7;color:#fff;font-size:16px;font-weight:700;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:all .4s cubic-bezier(.4,0,.2,1)}.btn-drone .drone{position:absolute;top:-30px;left:65px;font-size:24px;transition:all 1s ease-in-out}.btn-drone .package{position:absolute;bottom:-30px;left:70px;font-size:16px;transition:all 1s ease-in-out}.btn-drone .text{transition:.3s}.btn-drone.is-active .text{opacity:0}.btn-drone.is-arriving .drone{top:10px}.btn-drone.is-arriving .package{bottom:0}.btn-drone.is-flying .drone,.btn-drone.is-flying .package{transform:translate(100px,-60px) scale(.5)}.btn-drone.is-delivered{background:#10b981}
</style>Angular
import { Component } from '@angular/core';
@Component({
selector: 'app-drone-delivery-button',
template: `<button class="btn-drone" [class.is-arriving]="state==='arriving'" [class.is-flying]="state==='flying'" [class.is-delivered]="state==='delivered'" (click)="handleClick()" [disabled]="state!=='idle'">
<span class="drone" style="position:absolute;top:-30px;left:65px;font-size:24px">🚁</span>
<span class="package" style="position:absolute;bottom:-30px;left:70px;font-size:16px">📦</span>
<span class="text" style="position:relative">{{ state==='delivered' ? 'Delivered' : 'Deliver' }}</span>
</button>`,
styles: [`.btn-drone{width:160px;height:50px;border-radius:12px;border:none;background:#0284c7;color:#fff;font-size:16px;font-weight:700;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:all .4s cubic-bezier(.4,0,.2,1)}.btn-drone .drone{position:absolute;top:-30px;left:65px;font-size:24px;transition:all 1s ease-in-out}.btn-drone .package{position:absolute;bottom:-30px;left:70px;font-size:16px;transition:all 1s ease-in-out}.btn-drone .text{transition:.3s}.btn-drone.is-active .text{opacity:0}.btn-drone.is-arriving .drone{top:10px}.btn-drone.is-arriving .package{bottom:0}.btn-drone.is-flying .drone,.btn-drone.is-flying .package{transform:translate(100px,-60px) scale(.5)}.btn-drone.is-delivered{background:#10b981}`]
})
export class DroneDeliveryButtonComponent { state='idle';handleClick(){if(this.state!=='idle')return;this.state='arriving';setTimeout(()=>this.state='flying',1200);setTimeout(()=>this.state='delivered',2200);setTimeout(()=>this.state='idle',5000);}}LWC — HTML template
<template><button class="btn-drone" onclick={handleClick} disabled={disabled}>
<span class="drone" style="position:absolute;top:-30px;left:65px;font-size:24px">🚁</span>
<span class="package" style="position:absolute;bottom:-30px;left:70px;font-size:16px">📦</span>
<span class="text" style="position:relative">{label}</span>
</button></template>LWC — JavaScript
import { LightningElement } from 'lwc';
export default class DroneDeliveryButton extends LightningElement {
state = 'idle';
get disabled() { return this.state !== 'idle'; }
get label() { return this.state==='delivered' ? 'Delivered' : 'Deliver'; }
handleClick() {
if (this.state !== 'idle') return;
this.state = 'arriving';
const btn = this.template.querySelector('button');
btn.classList.add('is-active','is-arriving');
setTimeout(() => { btn.classList.remove('is-arriving'); btn.classList.add('is-flying'); }, 1200);
setTimeout(() => { btn.classList.add('is-delivered'); this.state = 'delivered'; }, 2200);
setTimeout(() => { btn.classList.remove('is-active','is-flying','is-delivered'); this.state = 'idle'; }, 5000);
}
}LWC — CSS
.btn-drone{width:160px;height:50px;border-radius:12px;border:none;background:#0284c7;color:#fff;font-size:16px;font-weight:700;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;transition:all .4s cubic-bezier(.4,0,.2,1)}.btn-drone .drone{position:absolute;top:-30px;left:65px;font-size:24px;transition:all 1s ease-in-out}.btn-drone .package{position:absolute;bottom:-30px;left:70px;font-size:16px;transition:all 1s ease-in-out}.btn-drone .text{transition:.3s}.btn-drone.is-active .text{opacity:0}.btn-drone.is-arriving .drone{top:10px}.btn-drone.is-arriving .package{bottom:0}.btn-drone.is-flying .drone,.btn-drone.is-flying .package{transform:translate(100px,-60px) scale(.5)}.btn-drone.is-delivered{background:#10b981}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 Drone Delivery fits
- Delivery
- Dispatch
- Ship
- Transport
- Air Drop
Interaction states & animations
- Drone Descend
- Package Pickup
- Fly Away
- Delivered
Topics
- #drone
- #delivery
- #fly
- #package
- #air
- #transport
- #ship
Accessibility notes
Drone flight animation is decorative. Announce state changes via aria-live.
Browser support
- All modern browsers