ObjectStackObjectStack

Animation

Animation protocol schemas

Transition Preset Schema

Common animation transition presets.

Source: packages/spec/src/ui/animation.zod.ts

TypeScript Usage

import { AnimationTrigger, ComponentAnimation, EasingFunction, MotionConfig, PageTransition, TransitionConfig, TransitionPreset } from '@objectstack/spec/ui';
import type { AnimationTrigger, ComponentAnimation, EasingFunction, MotionConfig, PageTransition, TransitionConfig, TransitionPreset } from '@objectstack/spec/ui';

// Validate data
const result = AnimationTrigger.parse(data);

AnimationTrigger

Event that triggers the animation

Allowed Values

  • on_mount
  • on_unmount
  • on_hover
  • on_focus
  • on_click
  • on_scroll
  • on_visible

ComponentAnimation

Component-level animation configuration

Properties

PropertyTypeRequiredDescription
labelstring | ObjectoptionalDescriptive label for this animation configuration
enterObjectoptionalEnter/mount animation
exitObjectoptionalExit/unmount animation
hoverObjectoptionalHover state animation
triggerEnum<'on_mount' | 'on_unmount' | 'on_hover' | 'on_focus' | 'on_click' | 'on_scroll' | 'on_visible'>optionalWhen to trigger the animation
reducedMotionEnum<'respect' | 'disable' | 'alternative'>Accessibility: how to handle prefers-reduced-motion
ariaLabelstring | ObjectoptionalAccessible label for screen readers (WAI-ARIA aria-label)
ariaDescribedBystringoptionalID of element providing additional description (WAI-ARIA aria-describedby)
rolestringoptionalWAI-ARIA role attribute (e.g., "dialog", "navigation", "alert")

EasingFunction

Animation easing function

Allowed Values

  • linear
  • ease
  • ease_in
  • ease_out
  • ease_in_out
  • spring

MotionConfig

Top-level motion and animation design configuration

Properties

PropertyTypeRequiredDescription
labelstring | ObjectoptionalDescriptive label for the motion configuration
defaultTransitionObjectoptionalDefault transition applied to all animations
pageTransitionsObjectoptionalPage navigation transition settings
componentAnimationsRecord<string, Object>optionalComponent name to animation configuration mapping
reducedMotionbooleanWhen true, respect prefers-reduced-motion and suppress animations globally
enabledbooleanEnable or disable all animations globally

PageTransition

Page-level transition configuration

Properties

PropertyTypeRequiredDescription
typeEnum<'fade' | 'slide_up' | 'slide_down' | 'slide_left' | 'slide_right' | 'scale' | 'rotate' | 'flip' | 'none'>Page transition type
durationnumberTransition duration in milliseconds
easingEnum<'linear' | 'ease' | 'ease_in' | 'ease_out' | 'ease_in_out' | 'spring'>Easing function for the transition
crossFadebooleanWhether to cross-fade between pages

TransitionConfig

Animation transition configuration

Properties

PropertyTypeRequiredDescription
presetEnum<'fade' | 'slide_up' | 'slide_down' | 'slide_left' | 'slide_right' | 'scale' | 'rotate' | 'flip' | 'none'>optionalTransition preset to apply
durationnumberoptionalTransition duration in milliseconds
easingEnum<'linear' | 'ease' | 'ease_in' | 'ease_out' | 'ease_in_out' | 'spring'>optionalEasing function for the transition
delaynumberoptionalDelay before transition starts in milliseconds
customKeyframesstringoptionalCSS @keyframes name for custom animations
themeTokenstringoptionalReference to a theme animation token (e.g. "animation.duration.fast")

TransitionPreset

Transition preset type

Allowed Values

  • fade
  • slide_up
  • slide_down
  • slide_left
  • slide_right
  • scale
  • rotate
  • flip
  • none

On this page