Primitives / foldkit-primitives/motion

Motion

namespace · packages/primitives/src/motion/motion.ts:9

export * as Motion from './motion.js'

Whether motion should be reduced, as a service read when a transition starts, not sniffed once. Absent, motion is full, so a placement that provides nothing behaves as before; a page provides live (the user's prefers-reduced-motion) and a test provides reduced or full. Under reduced motion a presence exits at once and a tween or spring jumps to its end, in the same Messages, so the Model sees the same transitions.

In the guides

Members

Motion.full

const · packages/primitives/src/motion/motion.ts:22

const full: Layer.Layer<Motion>

Motion.layer

function · packages/primitives/src/motion/motion.ts:18

function layer(reduced: boolean): Layer.Layer<Motion>

Reduced or full motion, fixed: for a test or a setting the application owns.

Motion.live

const · packages/primitives/src/motion/motion.ts:25

const live: Layer.Layer<Motion>

The user's prefers-reduced-motion, read each time a transition starts.

Motion.Motion

class · packages/primitives/src/motion/motion.ts:15

class Motion extends Context.Service<Motion, MotionShape>()(
  'foldkit-primitives/Motion',
) {}

Motion.MotionShape

interface · packages/primitives/src/motion/motion.ts:11

interface MotionShape {
  readonly reduced: Effect.Effect<boolean>
}

Motion.reduced

const · packages/primitives/src/motion/motion.ts:21

const reduced: Layer.Layer<Motion>

Motion.reducedMotion

const · packages/primitives/src/motion/motion.ts:35

const reducedMotion: Effect.Effect<boolean>

Whether to reduce motion now: the service's answer, or false without one.