Skip to Content
CodeUI

Motion

@codeui/inkstone v0.3.0

The work moves, controls respond, the keyboard is instant. Ten named movements and the rules behind them.

Inkstone motion follows Emil Kowalski's rules for interface animation, and Apple's rules from Designing Fluid Interfaces for anything the user drags. In one sentence: the work moves, controls respond, the keyboard is instant.

The values on this page were measured in CodeImage's editor by recording every transition and animation while using it.

First question: should it animate?

The more often something happens, the less it should animate. An animation that is pleasant once a day gets tiring at fifty times a day.

How oftenDecisionIn CodeImage
Keyboard action, or 100+ times a dayNeverThe command menu, Escape, arrow keys, shortcuts
Tens of times a day120ms or nothingSwitch, press, segments in a working panel
OccasionallyStandardAccordion, a popover opened by click, the settings dialog
RarelyMay delightWhat's new, onboarding

Every animation also needs a purpose you can name: feedback, showing where something came from, explaining a change of state, or avoiding a jump. If you cannot name one, don't animate.

The movements

Naming the movements gives designers, developers and agents a shared vocabulary. Use these names in reviews and pull requests.

NameWhereRecipe
PressButtons, cardsscale(0.97) on pointer-down, 120ms ease-out
ToggleSwitchThumb slides 120ms ease-out; track colour 120ms
PopPopover, menu, list popover, tooltip opened by pointerFrom scale(0.96) with a fade, 160–180ms; out 120ms; grows from the trigger. Opened from the keyboard, it does not animate
ExpandAccordionHeight and opacity 200ms, reversible mid-way
MorphThe content after a value changesThe changed property, 150–200ms
Collapse to originClosing something that lives on elsewhereShrinks into where it can be found again, 200ms
RiseCorner card, toastFrom the edge 400ms; leaves in 200ms
RevealA surface growing in placeclip-path, 260ms
SlidePhone sheet, side sheetFrom its edge in 260ms on the drawer curve; out in 200ms ease-out; turns around if reopened mid-exit; follows the finger when dragged
RingSelection ringFrom scale(0.92) with a fade, 200ms

The best example: collapse to origin

When you minimise CodeImage's large "What's new" dialog, it does not just fade out. It shrinks to a third of its size and slides into the small card in the bottom-left corner, in 200ms. The motion tells the user where the content went, so they know where to find it again. This is what motion is for in Inkstone.

Spinners share one clock

Several spinners that mount at different moments, in a sidebar row, a list entry and a chip, turn out of phase and look like separate, nervous activities. Every spinner turns on one clock, aligned to the document timeline, so they read as one. Proposed: the kit Spinner does this itself.

What stays still

In CodeImage's side panel, the segmented control's indicator jumps to the new option instead of sliding. That is deliberate. The control is used many times while working, and the content it changes, such as the frame radius, animates instead. The control responds instantly and the content changes smoothly.

The command menu opens with no animation because it is opened from the keyboard. Moving through its rows changes the theme on the canvas immediately, and Escape puts it back.

The ingredients

Fig. 1The curve
Inkstone · ease-out
ease-in · slow start
linear · mechanical
slowed 3× to 600ms so the difference is visible
Ease-out moves first and settles last. The user sees the response at once. Ease-in waits at the start, which is exactly when the user is watching.
Fig. 2Press
Inkstone · 120ms ease-out
Kit today · 200ms ease
press and hold each button
Press and hold. At 120ms ease-out the button answers under the finger. At 200ms ease, the kit's current value, it lags behind.
Fig. 3Pop from the trigger
Grows from its triggerBackground ▾
Gradient✓
Colour
Grows from its centreBackground ▾
Gradient✓
Colour
A popover grows out of what opened it. From the centre it seems to come from nowhere. Modals are the exception: they belong to the whole page, so they open from the centre.
  • Ease-out for anything entering or responding. The curve is cubic-bezier(0.23, 1, 0.32, 1): it starts fast and settles gently. Never use ease-in on interface elements, because it delays the start of the motion, which is exactly the moment the user is watching. Use ease-in-out only for something travelling across the screen.
  • Exits are faster than entrances, and they go back the way the element came in.
  • Only transform, opacity and clip-path. These animate on the GPU. The accordion's height is the one exception.
  • Transitions, not keyframes. A transition can be reversed from wherever it is. A keyframe animation restarts from the beginning. If the user clicks twice, the motion should turn around, not jump.
  • Never start from nothing. Start at 0.96 scale, not 0.
  • Tooltips: after the first one opens, the next ones open instantly, with no delay and no animation.
  • Drags track the finger 1:1 from where it was grabbed. On release, the settle animation continues at the finger's speed, and the element rubber-bands at its limits.
  • Know the input, not the focus. "Keyboard instant" depends on which input the user touched last, not on :focus-visible: a script that focuses an input after a click makes the browser report :focus-visible for a mouse user. The kit writes the last input to <html data-cui-input> (keyboard or pointer) and keys its keyboard-only rules on it: the switch's focus ring, and no slide for the switch thumb, the segmented and tab indicators, or the accordion body after a key press.
  • Reduced motion keeps fades and colour changes and drops movement and scaling.
  • Hover effects only on devices with a mouse, using @media (hover: hover) and (pointer: fine). Otherwise a tap leaves an element stuck in its hover state.

What Inkstone does not take from Apple

Apple's design language uses translucent materials: blurred, frosted toolbars and sheets that let content show through. Inkstone does not. Matte is one of its traits, and a blurred panel would put a softened copy of the user's work behind the interface, which is the opposite of keeping the two apart. Inkstone uses Apple's guidance on motion and gestures, not on materials.

Where the kit lags behind

The kit's own components are slower and softer than the app that uses them.

Today in the kitShould be
Button press: 200ms easePress, 120ms ease-out
Focus ring: 150ms ease-inA 120ms colour change, ease-out
Dialog: Pop as keyframes, in 200ms from scale(0.96), out 120ms toward scale(0.98), scrim fades, no motion from the keyboardPop, as a reversible transition
Segmented indicator: 160ms ease-out on click, instant from the keyboard200ms ease-out, or no animation in working panels

One curve is still missing from the tokens: --cui-motion-ease-in-out. The drawer curve is --cui-motion-ease-drawer, and the kit sheet slides on it.

On this page