Building Cinematic Interfaces with Next.js and animejs
How to combine Next.js's server-first architecture with animejs to build motion-rich interfaces that stay fast, accessible, and SEO-friendly.
Mehran Hatami4 min readMost "animated" websites make a trade-off: they sacrifice performance or SEO for motion. Next.js's App Router lets you avoid that trade-off entirely — render content on the server for search engines and first paint, then layer interactivity on top with small, targeted Client Components.
Scope motion to what's actually on screen
Always check prefers-reduced-motion before any entrance or hover animation runs — treat it as a hard requirement, not an afterthought.
animejs fits naturally into this model. Instead of animating everything on mount, I scope entrance animations to individual sections using the Intersection Observer API, so motion only plays when a section actually enters the viewport. That keeps the initial page weight low and avoids animating content the visitor never scrolls to.
This is also where a scoped animation controller earns its keep: mounting and reverting a scope per section means every animation it created is cleaned up automatically when the section unmounts, so there's no manual bookkeeping of timelines to leak.
Reduced motion is a requirement, not a nice-to-have
The trickiest part is respecting user preferences. Every animation in a cinematic interface should have a "reduced motion" fallback — content that's simply visible, immediately, with no movement. I treat that as a hard requirement, not an afterthought, and check for prefers-reduced-motion before any entrance or hover animation runs.
- Gate every animation call behind a single reduced-motion hook — never scatter the check across dozens of components
- When reduced motion is on, render the end state immediately instead of skipping the element entirely
- Keep pointer-driven effects (magnetic buttons, custom cursors) behind the same gate as scroll-triggered ones
- Test with the OS-level setting turned on, not just by reading the code
The result is an interface that feels alive without feeling heavy: staggered reveals, orbiting elements, and subtle hover feedback, all built on top of a page that still loads fast and reads perfectly to search engines.