UI Micro-interactions
Add to Cart Fly
Product tile flings a mini clone in a bezier arc into a cart icon on click; badge count bumps with a spring bounce. Auto-cycles as demo.
csslight complexitymoderate motionclick
Open on the canvas to copy the code → Free account · 3 copies a day · membership goes unlimited
Worth keeping?
Votes steer what gets built next — sign in to cast one, free to read
When to use it
E-commerce product cards, shopping cart add actions, any buy/collect CTA needing tactile feedback.
When not to
Passive display contexts — remove the auto-cycle loop before shipping. Avoid on pages with many simultaneous cart actions (no queue).
Working with an AI agent
Every component ships agent-ready metadata. An example instruction for this one:
Change the product emoji to '👟', set the accent color to #a855f7 (update .fly gradient and stroke color), and slow the fly animation to 900ms duration. Theme: dark tokens live in :root, the light variant in :root[data-theme="light"]; ?theme=light or a {type:'forever:theme'} postMessage switches at runtime.
Safe to edit
- fly animation duration (680ms)
- arc height offset (-50px)
- product emoji (🎧)
- accent color (#5cc8ff)
- badge bounce scale (1.6)
- idle demo cadence (FIRST=400 / DEMO_EVERY=2800 / IDLE_BACK=3600 ms)
- theme tokens (:root dark defaults + [data-theme=light] overrides)
Keep intact
- visibilitychange pause/resume
- reduced-motion guard (if reduce return)
- Web Animations API animate() calls
- IIFE wrapper
- empty-cart badge state (.badge.empty) — the demo's first-add cue
- theme hook (?theme= bootstrap + forever:theme message listener + theme tokens)
Known limitations
- Idle demo cycle runs by default (real input takes over, resumes after a few idle seconds) — remove the demo block for purely on-demand interaction
- No queue: rapid clicks spawn multiple fly elements simultaneously
More UI Micro-interactions components
- Notification BellSVG bell swings and rings with a ripple wave on click; a red badge counter pops in with a springy bounce and increments each ring. Auto-cycles every 2…
- Copy ConfirmCopy icon morphs to a drawn-stroke checkmark with a green button flash and a "Copied!" toast on click; auto-cycles as a demo loop.
- Swipe Card StackTinder-style draggable card stack — drag the top card left/right to reveal NOPE/LIKE stamps; fling-away animates it off-screen and cycles to the next card.
- Pull to RefreshA phone-frame mockup with draggable list rows; pulling down reveals a teal arc spinner that fills and rotates, then triggers a skeleton-row flash on release.
- Accordion ExpandThree FAQ panels smoothly expand and collapse with a CSS height transition; a chevron rotates 180 degrees to indicate open state. Auto-cycles as demo.
- Tooltip PopHeart icon button springs a mint-green tooltip above it on hover with a cubic-bezier spring pop; click triggers a subtle press-bounce via Web Animations API.