A showcase of custom Svelte 5 animation techniques ā built with pure CSS, zero dependencies, and runes syntax.
An animated card grid featuring three hand-crafted Svelte transition functions:
| Transition | Effect |
|---|---|
rippleFloat |
Card lifts upward with a blur dissolve |
magneticSnap |
Elastic bounce entrance from the side |
unfold |
Scales open from the top like unfolding paper |
Each card also has:
$state, $derived)# Install dependencies
npm install
# Run dev server
npm run dev
# Build for production
npm run build
src/
āāā lib/
ā āāā AnimatedCard.svelte # Main component with all animations
āāā routes/
āāā +layout.svelte
āāā +page.svelte
Svelte's transition API accepts any function that returns { delay, duration, easing, css }. This project uses that to build transitions far beyond what fly, fade, or scale offer out of the box.
const rippleFloat = (node, { delay = 0, duration = 600, y = 40 } = {}) => ({
delay,
duration,
easing: cubicOut,
css: (t) => {
const eased = cubicOut(t);
return `
opacity: ${eased};
transform: translateY(${(1 - eased) * y}px) scale(${0.9 + eased * 0.1});
filter: blur(${(1 - eased) * 6}px);
`;
},
});
Mouse position is tracked relative to the card's bounding box and fed into a Svelte spring store, which smoothly interpolates the 3D rotation values via CSS custom properties.