CodeVetter · Repo Unpack · Data flow
motiondivision/motion
Inputs enter through component props, imperative subjects and keyframes, selectors, or browser events. Subject resolution and option normalization feed motion values, keyframe resolvers, and animation playback objects. Rendering is scheduled through ordered frame phases or delegated to browser animation APIs. Completion and cleanup update group controls, effect bindings, and retained React children; the separately inspected release path writes changelog artifacts.
- Selector input is resolved against scope.current when scoped, otherwise document; null subjects resolve empty, NodeLists become arrays, and arrays discard null members before dispatch.
- animateSubject clones transitions per subject, evaluates functional delay with index and total, routes DOM elements through animateElement, and routes other objects through a matching registered effect or propEffect.
- animateElement shares an existing VisualElement's values when supplied; otherwise it selects HTML-style or SVG effects and provides an EffectSubject adapter for DOM reads, rendering, and measurement.
- animateEffectSubject reuses bound values or creates MotionValues; non-DOM origins come from an explicit first keyframe or effect.read(), and unreadable origins trigger an invariant.
- animateMotionValue combines value-specific options with velocity and callbacks, translates public seconds to milliseconds, and applies skip-animation conditions before choosing synchronous JS or asynchronous resolution.
- DOMKeyframesResolver samples CSS variables and detects positional unit changes; queued resolvers batch origin/end measurement and temporary transform removal before reporting resolved keyframes.
- MotionValue updates notify change subscribers and dependents; MotionValueState deduplicates scheduled writes, and style effects emit transforms, transform origins, CSS custom properties, or typed style values.
- The changelog data path reads CHANGELOG.md, serializes escaped version/date/content/type/slug CSV rows into changelog.csv, then optionally copies that file to motion-api's site content as motion.csv.