# CSS animation easing and prefers-reduced-motion: motion that feels designed

> Stop making everything fade up. Give each animation a job, with simple durations, easing curves, one hero entrance, hover feedback and reduced motion, in CSS you can paste into an Astro site.

Canonical page: <https://aymu.dev/blog/motion-that-feels-designed>

Published 28 Nov 2026.

Ask a coding agent to "add some animation" and you'll almost always get the same thing. Every section fades in
and slides up 20 pixels as it scrolls into view. So does every card and every heading. Sometimes every word of the
heading does it, one after another.

It doesn't feel lively. It feels like a template. Your visitor scrolls, waits for the text, scrolls again, waits
again. By the third section they know the trick, and now it just wastes their time.

Designed motion is quieter and more specific. Each animation has a reason, and you can say that reason in one
sentence. Here's how to get there with plain CSS in an Astro project.

## Ask what each animation is for

Before you keep an animation, name its job. There are only a few good ones:

- **Feedback.** A button reacts when you press it. A link changes when you hover it. The page shows it heard you.
- **Orientation.** A menu slides in from its own side. A drawer opens from the edge it closes into. The motion
  shows where something came from.
- **Continuity.** A tab indicator glides from the old tab to the new one, so your eye follows the change instead
  of jumping.
- **One first impression.** The hero gets a short, planned entrance on page load. Once.

"It looked empty without it" isn't on the list. Neither is "the section is entering the viewport." Content that's
already there doesn't need to arrive.

## Pick durations from a short scale

Generated code often uses `transition: all 0.5s ease` everywhere. Half a second is slow for a hover. And `all`
animates things you never meant to touch, like a size or position that changes when a class toggles.

![A duration scale: 120ms for hover, press and color changes, 200ms for small movement, 320ms for drawers and the hero entrance.](/blog/figures/motion-that-feels-designed-1.png)

Use a small scale, and match it to the size of the change:

```css
:root {
  --dur-fast: 120ms; /* hover, press, color changes */
  --dur-base: 200ms; /* small movement: toggles, dropdowns */
  --dur-slow: 320ms; /* larger movement: drawers, the hero entrance */
}
```

Small things move fast. A hover color change at 120ms feels instant but smooth. A drawer crossing half the screen
needs more time, or it looks like a jump. Very little on a marketing page needs more than 400ms.

Name the properties you animate. `transition: background-color var(--dur-fast)` is cheaper and easier to predict
than `transition: all`.

## Use real easing curves

The default `ease` keyword is fine for color. For movement, it's one reason so much generated motion looks the
same. Set up two or three curves and reuse them:

```css
:root {
  /* Entering: starts quick, settles gently. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  /* Leaving: starts slow, exits quick. */
  --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
  /* Moving from one place to another on screen. */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}
```

A simple rule: things that appear use ease-out, because they should arrive fast and then settle. Things that
disappear use ease-in, because they should get out of the way. Things that travel across the screen, like a tab
indicator, use ease-in-out.

Skip bounce and elastic curves on a professional site, unless the product is playful on purpose. They pull
attention to the animation and away from the content.

## Plan one entrance, not twenty

If you want something to animate on load, pick the hero and plan it as a short sequence. First the headline,
then the supporting line, then the buttons. Small offsets and short delays, all done in well under a second.

```html
<section class="hero">
  <h1 class="enter" style="--delay: 0ms">Invoices your clients pay on time</h1>
  <p class="enter" style="--delay: 80ms">Send, track and follow up from one inbox.</p>
  <div class="enter" style="--delay: 160ms">
    <a href="/signup" class="btn">Start free</a>
  </div>
</section>
```

```css
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.enter {
  animation: enter var(--dur-slow) var(--ease-out) both;
  animation-delay: var(--delay, 0ms);
}
```

Look at the distance: 8 pixels, not 40. A short move looks like "settling into place." A long one looks like
"flying in." Keep the gaps between elements small too, so the whole thing ends before a visitor would start
reading anyway.

Everything below the hero can just be there. If you want one more scroll moment, give it to one section that has
something to show. That could be a product screenshot or a chart that draws its line. One is a choice. Ten is a
habit.

![Stella template hero: a dark page with a glowing magenta 3D X between the words A human first and design studio](/blog/examples/stella.jpg)

*Example: [Stella](/templates/stella), a designed Astro template on Aymu.*

## Keep text readable while it moves

This is where generated motion does the most harm. Text that fades in from 0 opacity as you scroll sits at 30 or
50 percent for a moment. That fails contrast and is hard to read. Split-word animations break a headline into
pieces the visitor has to put back together.

A few rules keep text easy to read:

- Animate text as one block. No per-letter or per-word reveals on body copy, and be very careful with them on
  headlines.
- Keep the fade short, so text spends almost no time half-transparent.
- Never tie text opacity to scroll position. If the visitor stops scrolling halfway, the text shouldn't stay
  faded.
- Don't hide content until JavaScript runs. If your script fails or loads late, the page should still show
  everything. Start visible, and treat the animation as an extra.

## Give hover and press real feedback

Hover states are where motion is most useful, and generated sites often skip them or overdo them. The usual slop
version is a card that lifts, grows and gets a glow. Simpler works better:

![Two cards: a hover card that lifts, grows and gains a glow is crossed out; a tone change on hover and a tiny press on click are ticked.](/blog/figures/motion-that-feels-designed-2.png)

```css
.btn {
  transition:
    background-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}
.btn:hover {
  background-color: var(--color-ink-hover);
}
.btn:active {
  transform: scale(0.98);
}

.card-link {
  transition: background-color var(--dur-fast) var(--ease-out);
}
.card-link:hover {
  background-color: var(--color-surface-hover);
}
```

A tone change on hover and a tiny press on click is enough. The visitor knows they can click it, and the layout
doesn't move under the cursor.

In Tailwind CSS v4 you can do the same with utilities, as long as your theme defines the tokens (here
`--color-ink` and `--color-ink-hover`). v4's `scale-*` utilities set the `scale` property, not `transform`. So
name `scale` in the transition, or the press won't animate:

```html
<a class="bg-ink text-white transition-[background-color,scale] duration-120 hover:bg-ink-hover active:scale-[0.98]">
  Start free
</a>
```

## Respect reduced motion

Some visitors turn on reduced motion because animation makes them dizzy or distracts them. Respect that. The
simplest way is to remove movement and keep instant state changes:

```css
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
```

Using 1ms instead of `none` keeps any `animationend` listeners firing, so scripts that wait for an animation don't
get stuck. Test it: on macOS, turn on Reduce motion in the Accessibility settings, reload, and check that nothing
slides and nothing stays hidden.

## A prompt to clean up your site today

Paste this into Claude Code in your project:

```text
Audit every animation and transition in this Astro site.

1. List each one with its file, the element, duration, easing and what triggers it.
2. Remove scroll-triggered fade-ups on everything except the hero.
3. Replace `transition: all` with named properties.
4. Add duration tokens (120ms, 200ms, 320ms) and easing tokens (ease-out,
   ease-in, ease-in-out cubic-bezier curves) to the global CSS, and use them.
5. Give the hero one entrance: headline, subline, buttons, 8px travel,
   80ms between each, ease-out.
6. Hover states change background tone only. No lift, scale or glow on hover.
7. Add a prefers-reduced-motion block that removes movement.
8. Make sure no content is hidden before JavaScript runs.

Show me the list before you change anything.
```

Asking for the list first matters. You'll probably find more animations than you expected, and you get to decide
which ones have a job.

## Where this fits

Motion is usually the last layer. If the page underneath still looks generic, animation won't save it. Fix the
structure first with [a better hero](/blog/rewrite-a-generic-hero-section) and
[Hero section design: fix a generic AI hero, step by step](/blog/rewrite-a-generic-hero-section), and get the
[spacing](/blog/spacing-makes-ai-sites-look-cheap) right. Then add the few movements that help, and keep the rest
of the page still.
