Skip to content
Writing
Engineering
· · 3 min

An animation is not an interaction.

listen to this article from the Wonder Why? podcast
Listen

Whenever I come across an extraordinary component on X, I find myself asking a couple of questions.

How performant is this? How accessible is it? And if this is such a fundamentally better way of interacting with software, why isn't it more common?

Sometimes the answer is simply that nobody has thought of it before. Other times, it makes for a considerably better demonstration than an actual user experience.

There's a distinction between engineering something that moves beautifully and engineering something that responds beautifully.

A recording only needs the former.

Humans are terribly inconvenient

One of the problems with demonstrating interactions through recordings is that everything happens exactly as intended.

The cursor moves towards the component, clicks it, waits for the animation to finish and proceeds to the next action.

What a beautifully obedient human. Lol.

Real humans click twice, change their minds, drag in the wrong direction and press Escape halfway through an animation.

Consider an expandable panel. A simplistic implementation might prevent further interaction until its animation completes.

function toggle() {
  if (animating) return;

  animating = true;
  open = !open;

  animate(open).finally(() => {
    animating = false;
  });
}

We've effectively made the animation more important than the user's intention. For the duration of that animation, the human has temporarily lost control of the software.

A more considered approach is to separate the desired state from its visual representation.

function toggle() {
  open = !open;
  spring.setTarget(open ? 1 : 0);
}

The spring redirects from its current position and velocity. It doesn't restart, and it doesn't need to finish before accepting another instruction.

The animation reports the state. It doesn't govern it.

Ada Okafor14 Marlowe Street, London E2 7QPStandard delivery · arrives Thursday
Shipping details
Not recommended: Waits for the animation
Ada Okafor14 Marlowe Street, London E2 7QPStandard delivery · arrives Thursday
Shipping details
Recommended: Follows every press
Press twice fast, as if you changed your mind. One press reaches both panels; the dashed outline is where your last press asked the panel to be.

Write the state table first

I once reviewed an animated music player that looked rather impressive. Beautiful transitions, expanding surfaces, animated visualisations.

Except I couldn't pause the damn music.

It's quite interesting how easily you can get lost in the visual sophistication of a component and forget its fundamental purpose.

I've since grown particularly fond of writing state tables before implementing complex interactions.

Consider a media player:

Paper MoonsThe Quiet Hours
0:00Idle0:24
The player's state table
StateEventNext state
IdlePlayPlaying
PlayingPausePaused
PausedPlayPlaying
PlayingTrack endsEnded
EndedPlayPlaying
Send events and watch which row answers. Then take the Pause row out, press Play, and try to pause.

This is a deliberately simplified model, but notice that every state has a meaningful way out. Before introducing a single animation, we've established the behavioural contract of the component.

The expanding surface, the waveform and the changing icon are simply visual representations of that contract.

A beautiful pause button that doesn't pause anything isn't a poorly animated button. It's an incomplete piece of software.

One gesture, multiple intentions

Things get particularly interesting when a component supports more than one interaction.

Imagine a list item that can be clicked to open something or dragged horizontally to reveal an action.

A pointer-down event alone doesn't tell us which operation the human intends to perform.

We need to establish that intention before committing to an interaction.

function resolveGesture(dx: number, dy: number) {
  if (Math.hypot(dx, dy) < 6) {
    return "pending";
  }

  return Math.abs(dx) > Math.abs(dy)
    ? "swipe"
    : "scroll";
}

Once the gesture has been classified, retain that decision for its lifetime. Otherwise, a slightly diagonal movement could continuously alternate between scrolling and swiping.

And remember that a drag can be followed by a click event. Without distinguishing the two, releasing a swipe might accidentally open the very item you were trying to dismiss.

These are the things a recording rarely reveals.

Invoice #2040Bolt Studio · paid₦32,000
Invoice #2041Kemi’s Bakery · due 12 Dec₦48,000
Invoice #2042Harbour & Co. · due 20 Dec₦61,500
Drag Invoice #2041 left, once straight and once at a slant, in each mode. Watch the label on your finger, then whether letting go opened it.

It's also why I find interaction engineering so interesting. We're attempting to infer human intention from an incredibly limited collection of numerical inputs.

What does done actually mean?

I've started interrogating components beyond the interaction I initially designed them for.

Can I operate it with a keyboard? Does it behave correctly when interrupted? Does dragging it interfere with scrolling? What happens when reduced motion is enabled? Does its animation loop continue consuming resources when absolutely nothing is happening?

And perhaps the most important question: does any of this sophistication actually improve the experience?

Because you can spend an extraordinary amount of time engineering an interaction that would have been considerably more useful as an ordinary button.

I don't think exceptional interaction engineering is exclusively about anticipating how people will use software. It's equally about accommodating the ways we didn't anticipate.

The recording ends when the animation finishes.

The interaction ends when the human is done with it.

And those are rarely the same thing.

— Adenekan

Thoughts on this one?

Tell me what it made you think, or where you think I got it wrong.

Still working on the last 10%.0:00pm in london