Skip to content

Motion

Pulze animates only where it helps: numbers count up, charts draw in, cards arrive in order, and dialogs and drawers slide in. Every animation comes from one package, @pulze/motion (in the downloaded projects, src/motion/), built on Framer Motion.

The rules Pulze follows

Rule Value
Interface changes (menus, tabs, dialogs) 150–300 ms
Numbers counting, charts drawing 800 ms at most
Easing ease-out, no bounce
What moves opacity and transform only (smooth even on cheap phones)
How often once per view; nothing loops except the live dot and skeleton shimmer
Reduced motion always respected: nothing moves; short opacity fades remain
First page load server-rendered content shows at once, without an entrance animation

1. Change the timings

All numbers live in config/motion.ts:

export const motionConfig = {
  enabled: true,
  duration: { fast: 0.15, base: 0.22, slow: 0.3, count: 0.8 }, // seconds
  ease: [0.22, 1, 0.36, 1], // cubic-bezier, ease-out
  stagger: 0.04, // seconds between items in a list
}

Make everything snappier by lowering duration. Make lists arrive faster by lowering stagger.

2. Turn animations off

  • For one person: the theme drawer's Animations switch.
  • For everyone by default: theme.animations: false in site.config.ts.
  • Automatically: when a device has "Reduce motion" turned on (macOS, iOS, Windows, Android), Pulze never moves things around. Content simply appears.

3. The presets

Import from @pulze/motion:

import { CountUp, PageFade, Reveal, Shake, Stagger, StaggerItem } from "@pulze/motion"

Reveal

Fades in and rises 8 px the first time it scrolls into view.

<Reveal delay={0.1}>
  <ChartCard … />
</Reveal>
Prop Type Default
delay seconds 0
any div prop

Stagger and StaggerItem

A grid or list whose items arrive one after another.

<Stagger className="grid grid-cols-4 gap-gap">
  {kpis.map((k) => (
    <StaggerItem key={k.id}>
      <KpiCard {...k} />
    </StaggerItem>
  ))}
</Stagger>

CountUp

Counts from 0 to a value when it scrolls into view.

<CountUp value={revenue} format={(n) => formatMoney(n, { whole: true })} />
Prop Type Notes
value number The final number (for money: minor units)
format (n) => string Defaults to a rounded number
className string

Content that was rendered on the server shows its final value straight away. Only numbers that appear after data loads count up, so nothing flickers.

PageFade

Cross-fades page content on route change. The app shell already uses it, so you don't need to add it to your pages.

Shake

Shakes once whenever trigger changes (three small moves, 300 ms). Used for wrong codes and passwords.

const [attempt, setAttempt] = useState(0)
<Shake trigger={attempt}><OtpInput … /></Shake>
// on a wrong code: setAttempt((n) => n + 1)

Transitions and variants

For your own animations, reuse the shared values instead of typing numbers:

import { m, transition, fadeUp, scaleIn, slideIn } from "@pulze/motion"

<m.div initial="hidden" animate="show" variants={fadeUp} />
<m.div animate={{ opacity: 1 }} transition={transition.fast} />

Use m.div, not motion.div. Pulze loads Framer Motion in its smaller "lazy" mode, and m is the element that works with it.

Hooks

  • useMotionEnabled() returns false when animations are off or reduced motion is on. Use it to skip your own effects.

4. Adding a new preset

  1. Create it in src/motion/components.tsx.
  2. Use transition.* and motionConfig values, never new numbers.
  3. Check it with "Reduce motion" turned on in your OS.
  4. Export it from index.ts.

Why the first page doesn't animate in

In the Next.js version the first page arrives as HTML from the server. If blocks started invisible and faded in, nothing would show until JavaScript loaded, which takes seconds on a slow phone (and Lighthouse would score the page lower). So Reveal, Stagger and PageFade skip their entrance for anything that was server-rendered. Entrances still play for everything that appears later: the next page, data arriving, dialogs and drawers. The Vite version has no server HTML, so its entrances always play.

If you write your own entrance, use useShouldAnimate() from @pulze/motion: it's false for server-rendered content and when motion is off.