# theme/motion-values (zidane-ui)

Import: `import { … } from 'zidane-ui'`. Source: [ui/src/theme/motion-values.ts](https://github.com/Tahul/zidane/blob/main/ui/src/theme/motion-values.ts).

## Constants

### `MENU_FADE_RATIO`

Constant.

A menu's enter opacity lands ahead of its scale: \~100ms of the 140ms `menu`.

```ts
const MENU_FADE_RATIO = 0.7
```

Source: [ui/src/theme/motion-values.ts:59](https://github.com/Tahul/zidane/blob/main/ui/src/theme/motion-values.ts#L59)

### `MOTION_NAMES`

Constant.

Every [`MotionName`](https://zidane.si/docs/reference/ui-theme-motion-values.md#MotionName), in the order of [`MOTIONS`](https://zidane.si/docs/reference/ui-theme-motion-values.md#MOTIONS).

```ts
const MOTION_NAMES: MotionName[]
```

Source: [ui/src/theme/motion-values.ts:62](https://github.com/Tahul/zidane/blob/main/ui/src/theme/motion-values.ts#L62)

### `MOTIONS`

Constant.

The curve of every [`MotionName`](https://zidane.si/docs/reference/ui-theme-motion-values.md#MotionName): its spring (when it has one), tween duration in
seconds and easing.

```ts
const MOTIONS: Readonly<Record<MotionName, MotionSpec>>
```

Source: [ui/src/theme/motion-values.ts:43](https://github.com/Tahul/zidane/blob/main/ui/src/theme/motion-values.ts#L43)

## Interfaces

### `MotionSpec`

Interface.

The curve of one [`MotionName`](https://zidane.si/docs/reference/ui-theme-motion-values.md#MotionName).

```ts
interface MotionSpec
```

**Properties**

- `duration` (`number`): Tween (the twin, or the only curve): seconds + cubic-bezier.
- `ease` (`readonly [number, number, number, number]`): The tween's easing, as cubic-bezier control points.
- `fade?` (`boolean`): Opacity / colour: kept (briefly) under reduced motion; movement drops to 0.
- `reduced?` (`number`): Reduced motion keeps it as an opacity-only tween of this many seconds (the menus).
- `spring?` (`{ bounce: number; visualDuration: number }`): Spring: perceived duration in seconds and bounce (0 = critically damped). Absent: never springs.

Source: [ui/src/theme/motion-values.ts:17](https://github.com/Tahul/zidane/blob/main/ui/src/theme/motion-values.ts#L17)

## Types

### `MotionName`

Type.

Name of a motion in the design system's vocabulary. `snap`, `pop`, `panel`, `slide` and
`settle` are movement that springs; `exit` is a fast straight exit; `fade` and `fade-out` are
the opacity curves for entering and leaving; `menu` and `menu-exit` are the menu tweens.

```ts
type MotionName =
  | 'snap'
  | 'pop'
  | 'panel'
  | 'slide'
  | 'settle'
  | 'reorder'
  | 'exit'
  | 'fade'
  | 'fade-out'
  | 'menu'
  | 'menu-exit'
```

Source: [ui/src/theme/motion-values.ts:13](https://github.com/Tahul/zidane/blob/main/ui/src/theme/motion-values.ts#L13)
