The footer heart
Craft 08 · Motion, waapi
Built with ♥, and it means it.
The smallest thing on this site, and one I kept going back to.
Nine hearts
The heart in my footer is a button. Click it and nine small hearts come out of it, swell, drift off and fade. It's one keyframe animation per heart through the Web Animations API, nothing else: no library, no canvas, no requestAnimationFrame loop.
const drift = (Math.random() - 0.5) * 90;
const rise = 70 + Math.random() * 70;
const size = 0.6 + Math.random() * 0.7;
heart.animate(
[
{ transform: "translate(-50%, 0) scale(0.2)", opacity: 1 },
{
transform: `translate(calc(-50% + ${drift * 0.3}px), -24px) scale(${size * 1.25})`,
opacity: 1,
offset: 0.2,
},
{
transform: `translate(calc(-50% + ${drift}px), -${rise}px) scale(${size})`,
opacity: 0,
},
],
{
duration: 900 + Math.random() * 500,
delay: i * 35,
easing: "cubic-bezier(0.2, 0.8, 0.3, 1)",
fill: "backwards",
},
).finished.then(() => heart.remove());Burst, then float
Every heart rolls its own drift, height, size and duration, so no two clicks look the same and it never feels canned. The middle keyframe is the part I tuned longest: at a fifth of the way in, each heart has popped to a quarter bigger than its final size and moved only a third of its drift, so it bursts first and floats second, the way something light actually leaves your hand.
Small things
A few small things keep it clean. The hearts are fixed-position and appended to the body, so the footer's overflow can't clip them. fill: backwards holds each one invisible and small during its 35 ms stagger, so they don't all flash at the button before their turn. Each heart removes itself when its animation finishes, so a hundred clicks leave nothing behind. The character is ♥ followed by a text variation selector, so iOS doesn't swap it for the red emoji. And for anyone who prefers reduced motion, the click simply does nothing.