# Motion

Source: https://material.spynejs.com/foundations/motion
Part of: Material shell gallery, Google's Material Design 3 for SpyneJS. Index: https://material.spynejs.com/llms.txt

Material's ten easings and sixteen durations. The template's own moves use them; a model does not choose motion.

## In an app model

Nothing. How a thing moves follows from what it is and from the move being made. The moves between pages are on the Transitions page.

## The custom properties

An easing is `--md-sys-motion-easing-` and its name; a duration is `--md-sys-motion-duration-` and its name:

```css
.my-panel {
  transition: opacity var(--md-sys-motion-duration-short4)
    var(--md-sys-motion-easing-standard-decelerate);
}
```

- Material uses a decelerate easing for what arrives and an accelerate easing for what leaves.
- Whatever you make slide, grow or shrink, give it a rule for `@media (prefers-reduced-motion: reduce)`: a fade in its place. A thing that only fades needs none. See the Reduced motion page.
- Material’s Expressive set also has springs. CSS has nothing that takes them, so the template does not carry them.

## Where it is in the template

| File | What it holds | By name |
| --- | --- | --- |
| `src/scss/00-spynejs-design-system/tokens/_material.scss` | the easings and durations, read from Google’s tokens |  |
| `src/scss/03-components/material/_motion.scss` | the moves between pages, which use them |  |

The template is public: https://github.com/spynejs/application-shell-material. An app made from it has these same files.

## As the page shows it

The page’s own words, in its own order, read from the page as it is drawn in the light colour scheme. They were written for someone looking at the page: “above”, “below” and “marked” mean the drawn page. A thing the page draws is named here in its place (`Button:`, `Field:`, `Switch:`), and a box that reports what the reader does is as it starts, empty. What depends on the reader’s own window is left out.

How long a change takes, and how it speeds up and slows down. The switch over each list moves its markers to the far end, and back again when it is turned off. The Expressive set also has springs; CSS has nothing that takes them, so the template does not carry them.

### Easings

Every marker takes one second, so that its curve can be seen.

Switch: Move the markers

| Token | Custom property | Value |
| --- | --- | --- |
| easing-emphasized | `--md-sys-motion-easing-emphasized` | cubic-bezier(0.2, 0, 0, 1) |
| easing-emphasized-decelerate | `--md-sys-motion-easing-emphasized-decelerate` | cubic-bezier(0.05, 0.7, 0.1, 1) |
| easing-emphasized-accelerate | `--md-sys-motion-easing-emphasized-accelerate` | cubic-bezier(0.3, 0, 0.8, 0.15) |
| easing-standard | `--md-sys-motion-easing-standard` | cubic-bezier(0.2, 0, 0, 1) |
| easing-standard-decelerate | `--md-sys-motion-easing-standard-decelerate` | cubic-bezier(0, 0, 0, 1) |
| easing-standard-accelerate | `--md-sys-motion-easing-standard-accelerate` | cubic-bezier(0.3, 0, 1, 1) |
| easing-legacy | `--md-sys-motion-easing-legacy` | cubic-bezier(0.4, 0, 0.2, 1) |
| easing-legacy-decelerate | `--md-sys-motion-easing-legacy-decelerate` | cubic-bezier(0, 0, 0.2, 1) |
| easing-legacy-accelerate | `--md-sys-motion-easing-legacy-accelerate` | cubic-bezier(0.4, 0, 1, 1) |
| easing-linear | `--md-sys-motion-easing-linear` | cubic-bezier(0, 0, 1, 1) |

### Durations

Every marker takes its own duration, on the standard easing.

Switch: Move the markers

| Token | Custom property | Value |
| --- | --- | --- |
| duration-short1 | `--md-sys-motion-duration-short1` | 50ms |
| duration-short2 | `--md-sys-motion-duration-short2` | 100ms |
| duration-short3 | `--md-sys-motion-duration-short3` | 150ms |
| duration-short4 | `--md-sys-motion-duration-short4` | 200ms |
| duration-medium1 | `--md-sys-motion-duration-medium1` | 250ms |
| duration-medium2 | `--md-sys-motion-duration-medium2` | 300ms |
| duration-medium3 | `--md-sys-motion-duration-medium3` | 350ms |
| duration-medium4 | `--md-sys-motion-duration-medium4` | 400ms |
| duration-long1 | `--md-sys-motion-duration-long1` | 450ms |
| duration-long2 | `--md-sys-motion-duration-long2` | 500ms |
| duration-long3 | `--md-sys-motion-duration-long3` | 550ms |
| duration-long4 | `--md-sys-motion-duration-long4` | 600ms |
| duration-extra-long1 | `--md-sys-motion-duration-extra-long1` | 700ms |
| duration-extra-long2 | `--md-sys-motion-duration-extra-long2` | 800ms |
| duration-extra-long3 | `--md-sys-motion-duration-extra-long3` | 900ms |
| duration-extra-long4 | `--md-sys-motion-duration-extra-long4` | 1000ms |
