Skip to content

theme/motion-values

import { … } from 'zidane-ui'ui/src/theme/motion-values.ts

Constants#

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

TypeScript
const MENU_FADE_RATIO = 0.7

ui/src/theme/motion-values.ts:59

MOTION_NAMESConstant#

Every MotionName, in the order of MOTIONS.

TypeScript
const MOTION_NAMES: MotionName[]

ui/src/theme/motion-values.ts:62

MOTIONSConstant#

The curve of every MotionName: its spring (when it has one), tween duration in seconds and easing.

TypeScript
const MOTIONS: Readonly<Record<MotionName, MotionSpec>>

ui/src/theme/motion-values.ts:43

Interfaces#

MotionSpecInterface#

The curve of one MotionName.

TypeScript
interface MotionSpec
MotionSpec properties
NameTypeDescription
durationnumber

Tween (the twin, or the only curve): seconds + cubic-bezier.

easereadonly [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.

ui/src/theme/motion-values.ts:17

Types#

MotionNameType#

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.

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

ui/src/theme/motion-values.ts:13