Journal // Post

4 Dec 2026

Closing should be quicker than opening

An entrance has an audience and an exit does not. Give the way out a shorter duration than the way in, and keep the same curve.

  • design-engineering
  • motion

The easy way to animate something out is to play its entrance backwards: same duration, same curve, reversed. It is symmetrical and tidy, and it leaves every popover, menu and tooltip on screen a little longer than anyone wants it there.

The same menu twice, opened and closed together. They arrive identically and only the way out differs. The bar under each one runs for as long as that menu is moving.

A // 300ms in, 300ms out
Drafts
Published
Archive
Open 300ms
B // 300ms in, 180ms out
Drafts
Published
Archive
Open 300ms
Both menus open the same way. Close them and watch which one is still there when the other has gone.

The audience has left

When something opens, you asked for it. You are looking at the spot where it will appear and waiting to read what is in it, so the entrance has your full attention and can afford the time to show where it came from.

Closing is the opposite. You have already picked an item, pressed Escape or clicked somewhere else, and your eyes are on what comes next. The thing that is closing is now just an obstacle: for as long as its exit runs, it covers the content you are trying to get back to. Every millisecond of that animation is spent on something you have finished with.

How much shorter

Material Design's original motion guidelines made this a rule and put numbers on it: 225ms for an element entering the screen, 195ms for one leaving.

I cut further than that, to somewhere around 60 to 70 percent of the entrance. The demo opens in 300ms and closes in 180ms. The craft index on this site unfolds in 220ms and folds away in 150ms. The difference is hard to name when you see it, but the short exit feels like the interface keeping up with you, and the long one feels like waiting.

Keep the curve

Material also changes the curve for exits, to one that starts slow and accelerates. That suits something flying off the edge of the screen. It does not suit a popover fading out where it stands, because the slow part comes first, at the exact moment you want it gone.

Halfway through its duration, a CSS ease-in fade has done about a third of its work, so the popover is still two-thirds opaque. The ease-out curve this site uses, cubic-bezier(0.23, 1, 0.32, 1), is 97 percent done by the same point. It gets out of the way at once and spends its slow tail on something already nearly invisible. So I keep ease-out in both directions and change only the duration.

In CSS, the destination sets the timing

A CSS transition takes its duration from the styles the element is changing to, not the ones it is leaving. That means the closed state should carry the exit timing and the open state the entrance timing:

.popover {
  opacity: 0;
  transform: scale(0.97);
  transition:
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-out);
}

.popover[data-open] {
  opacity: 1;
  transform: none;
  transition-duration: 300ms;
}

Opening moves towards [data-open], so it runs for 300ms. Closing moves back towards the base rule, so it runs for 180ms. Nothing in JavaScript has to know which direction it is going.

In Motion, give the exit its own transition

By default the exit borrows the component's transition. Put a transition inside animate and exit and each gets its own. This is the menu from the demo:

<AnimatePresence>
  {open && (
    <motion.div
      initial={{ opacity: 0, scale: 0.95 }}
      animate={{ opacity: 1, scale: 1, transition: { duration: 0.3, ease } }}
      exit={{ opacity: 0, scale: 0.97, transition: { duration: 0.18, ease } }}
    />
  )}
</AnimatePresence>

The exit also travels less: it shrinks to 0.97 where the entrance grew from 0.95. A shorter animation covering the same distance moves faster, and that speed draws the eye back to something you were done with.

Shorter is not the same as none

It is tempting to follow this all the way down and remove the exit. Don't. Something that vanishes in a single frame reads as a flicker, and you lose the thread of where it went and whether you closed it or it broke. A short exit still tells you the thing left on purpose. The aim is for it to stop being in the way, and 150 to 200ms does that.