---
title: "Recipe: motion"
description: "Motion is CSS's: transition, keyframes and animation, -exact-exit-animation and -exact-layout-transition."
modificationDate: "2026-11-28"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Recipe: motion

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/recipes/motion: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

```prompt Add motion to my app
Add motion to the Exact app in this folder: rows that enter and leave, a section that expands, and a still screen for a person who asks for reduced motion. Use https://github.com/expo/exact/blob/main/docs/recipes/motion.md as the source for each step. The Exact checkout has the same page at docs/recipes/motion.md.

1. If this folder is not an Exact app (it has no exact.mjs and app.contract), stop and tell me.
2. If I did not say what moves (rows that enter and leave, a section that expands, a route change, a zoom from a row), propose it from the app and ask me before you write code.
3. In app.contract, write each `keyframes` block with literal values. A row enters with `animation`; a delay for each index staggers the rows. A row leaves with `-exact-exit-animation`: give the exit an end, and give the rows `-exact-layout-transition`, so the siblings move. A row that leaves is out of layout and inert at once.
4. Keep a section that expands mounted: `height` of `"auto"` or `"0px"`, `overflow="hidden"`, `inert` while it is closed, and `-exact-layout-transition`. An `if` row appears at full size.
5. Animate only what the recipe lists under Animates; a native `button` animates only opacity and transforms. `-exact-spring(stiffness, damping, mass)` is a `transition` timing with no duration: never write it in `animation`. For a route change, use `::view-transition-new` and `::view-transition-old`; modal sheets, and routes with a literal nonempty `navigationSource`, reject them. For a zoom, `navigationSource=` names the `id` of a visible source.
6. Read `exactViewport()` as a resource with `prefersReducedMotion`. While it is true, write `"none"` for each `animation`, `transition`, `-exact-layout-transition` and `-exact-exit-animation`.
7. Add a test in app.test.contract that says `prefer prefers-reduced-motion reduce`, removes a row and expects it missing. In each test, use `clock settle` after motion: never wait in real time.
8. Follow the platform checks in docs/start-here.md (`bun exact.mjs docs platform checks`) for the targets in the app's AGENTS.md and app.json until they pass. Read the reports, including counted findings; a zero exit code alone does not mean clean. Fix the app, not the test. To see motion play, film it: `bun exact.mjs agent web "<op>" "screenshot .exact/m.png over 600 every 50"`. If a finding stays after three rounds of fixes, or the app had it before you changed anything, record it (step 9) and report it; do not keep trying.
9. When a doc was wrong or missing, or a step needed a workaround, read `bun exact.mjs feedback status`. Under `never`, keep no note. Otherwise record it: `bun exact.mjs feedback note "<what happened>"`, which goes to Expo only as that status says. Do not change the policy; tell me how many notes you kept.
10. Tell me what moves and what reduced motion changes, what the tests and checks reported, and the launch command for each target platform.
```

```contract
keyframes rise
  from opacity=0 translate="0px 8px"
keyframes leave
  to opacity=0 scale=0.96 animation-timing-function="ease-in"
keyframes breathe
  50% opacity=0.4

shape Media
  prefersReducedMotion: bool

component App
  resource media = exactViewport() as shape Media
  derive still = media.prefersReducedMotion
  state items = ["Kick", "Snare", "Hat"]
  state open = false
  action toggle
    open = not open
  action remove(name: string)
    items = items.filter(i => i != name)
  view
    column padding=16 gap=8
      button press=toggle testId="toggle"
        text "Details"
      text "Saving…" animation=(still ? "none" : "breathe 1.6s ease-in-out infinite")
      column height=(open ? "auto" : "0px") overflow="hidden" inert=(not open)
        -exact-layout-transition=(still ? "none" : "320ms ease")
        text "Shown" opacity=(open ? 1 : 0) transition=(still ? "none" : "opacity 200ms ease")
      for name, i in items key=name
        row gap=8 animation=(still ? "none" : `rise 300ms ${i * 60}ms both`)
          -exact-layout-transition=(still ? "none" : "320ms ease")
          -exact-exit-animation=(still ? "none" : "leave 200ms ease-in both")
          text name flex=1
          button press=remove(name) testId=`remove-${name}`
            text "Remove"
```

- **Animates:** translate, scale, rotate, opacity, colours, `box-shadow`, SVG geometry,
  numeric `height`, `font-weight`, `font-stretch`, `font-variation-settings`, `filter`
  (transitions). Native `button`: opacity and transforms.
- **Spring:** `-exact-spring(stiffness, damping, mass)`: transition timing, no duration;
  not `animation`.
- **Hover scale:** `scale=1.08 transition="scale 150ms ease"` on `:hover` or
  `:focus-visible` grows paint and hits.
- **Keyframes:** literals or app `fn` on constants.
- **Exit:** an `if` arm or `for` row leaves layout and becomes inert at once.
  Give the exit an end. Siblings use layout transitions. Refused on route elements.
- **Routes:** `::view-transition-new` / `::view-transition-old` animate opacity,
  translate, scale and rotate. `animation="none"` cuts. Modal sheets and routes
  with a literal nonempty `navigationSource` reject these parts.
- **Layout:** surfaces move/resize; children jump, unscaled. `sharedElement=` flies
  in a page with `-exact-layout-transition` at both ends (not Linux/Windows) and
  across routes but sheets (not macOS).
- **Zoom:** `navigationSource=` names a source `id` for iOS 18 zoom or Android's
  container transform. Without a visible source, push uses shared axis and
  fullscreen cuts. Sheets have their own motion.
- **Expand/collapse:** an `if` row appears full size and siblings slide over.
- **JS target:** exit/layout bindings must be literals.
- **Stagger:** delays; `after(ms, action)`.
- **Reduced motion:** `exactViewport()` and `prefer prefers-reduced-motion reduce`.
  Flights land and routes cut.
- **Check:** `clock settle` or `screenshot .exact/m.png over 600 every 50`.
  Android drives refuse film; use `--live` and `adb shell screenrecord`.
