Motion & Animation
Motion in Eidetic follows one idea, Breath: movement that eases in and out the way breathing does, unhurried and without overshoot. Every curve is a cubic bezier. There are no springs, so nothing bounces past its target.
Duration Scale
Four tokens for every transition and animation
--duration-fast150ms--duration-base200ms--duration-slow300ms--duration-slower500msUse a token in Tailwind with duration-(--duration-base), or in CSS with var(--duration-base). Under prefers-reduced-motion all four drop to 0.01ms.
Breath Easing
Three curves, available as Tailwind utilities and as CSS variables
cubic-bezier(0.33, 1, 0.68, 1)Entering. Quick start, soft landing, for things that appear or settle into place
cubic-bezier(0.32, 0, 0.67, 0)Leaving. Slow start, then away, for things that close or move off screen
cubic-bezier(0.37, 0, 0.63, 1)Between two resting states, like a toggle thumb or a sliding panel
Standard easing, for comparison
cubic-bezier(0, 0, 0.2, 1)cubic-bezier(0.4, 0, 1, 1)cubic-bezier(0.4, 0, 0.2, 1)Compare the Curves
All four boxes travel over --duration-slower. With reduced motion turned on in your OS they jump, which is the global rule at work
Keyframe Animations
Tailwind's four built-in loops, which the components use
animate-spinSpinner and loading buttons. Keeps turning under reduced motion
animate-pingLive and notification dots
animate-pulseSkeleton placeholders while content loads
animate-bounceTyping and thinking dots
Code Examples
Durations and curves from the tokens, never hardcoded
Transition with Tailwind utilities
<button className="transition-colors duration-(--duration-fast) ease-breath-out hover:bg-primary-hover"> Save</button>Transition and keyframes in CSS
.panel { transition: transform var(--duration-slow) var(--ease-breath-out);}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; }}
.rise { animation: rise var(--duration-slow) var(--ease-breath-out);}Animation Best Practices
Guidelines for smooth, purposeful motion
Do
- Use ease-breath-out for entering and ease-breath-in for leaving
- Take durations from the tokens, so reduced motion and later tuning reach every component
- Animate
transformandopacityfor best performance - Use
will-changesparingly for known animations - Put
data-motion="essential"on loading indicators that must keep moving - Test animations on 60Hz and 120Hz displays
Don't
- Mix spring physics or overshoot with Breath easing
- Animate
width,height, ortop/left(use transform instead) - Go past 500ms (
--duration-slower) - Hardcode cubic-bezier values or millisecond numbers
- Rely on motion alone to tell people something happened
- Add animation to every element (use it purposefully)
Accessibility: Reduced Motion
What happens when a visitor asks their OS for less motion
globals.css makes every transition and keyframe animation finish at once. State still changes, and transitionend and animationend still fire, so code that waits for them keeps working. The --duration-* tokens drop to 0.01ms as well.
@media (prefers-reduced-motion: reduce) { *:not(.animate-spin, [data-motion='essential'], [data-motion='essential'] *) { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }}Loading indicators keep moving, because a frozen loader reads as a hung page. .animate-spin is exempt, and so is everything inside an element with data-motion="essential". Spinner sets that attribute on all its variants.
CSS cannot reach animation that runs in JavaScript. Loops built on requestAnimationFrame check usePrefersReducedMotion and show the end value straight away. CountUp and CircleProgress do this.
import { usePrefersReducedMotion } from '@/lib/use-reduced-motion'
const reduceMotion = usePrefersReducedMotion()
useEffect(() => { if (reduceMotion) return // render the end state, skip the loop let frame = requestAnimationFrame(function step(now) { // ...update, then frame = requestAnimationFrame(step) }) return () => cancelAnimationFrame(frame)}, [reduceMotion])