This guide documents the deterministic animation APIs shipped in the 1.2 baseline.
createTweenTimeline(initialValue)createPropertyTimeline(initialValues)setMotionPreference('full' | 'reduced')getMotionPreference()- Existing helpers:
transition,spring,animationLoop,easing
createPropertyTimeline supports numeric properties. Typical fields:
- Geometry:
x,y,width,height - Paint:
opacity - Additional numeric style values where caller-owned interpolation is acceptable
Non-numeric fields (for example string colors) should be converted by the caller to numeric channels before interpolation, then reconstructed at render time.
to(...)is interrupt-safe and starts from the current in-flight value.pause()freezes progression.resume()continues from paused progress.cancel()stops progression and keeps current value.step(deltaMs)is deterministic and does not depend on wall-clock timers.
setMotionPreference('reduced')makescreateTweenTimelineandcreatePropertyTimelinesnap immediately to new targets.transition(..., { respectReducedMotion: true })also snaps immediately.
- Keep row model positions in
createPropertyTimeline({ y }). - On reorder, call
to({ y: nextY }, 180, easing.easeOut)and step in the frame loop.
- Animate
opacityandytogether withcreatePropertyTimeline. - Enter:
to({ opacity: 1, y: 0 }, 220, easing.easeOut) - Exit:
to({ opacity: 0, y: -8 }, 140, easing.easeIn)
- Use
createTweenTimelinefor focus ring alpha or thickness values. - Interrupt on rapid focus changes; timeline starts from current in-flight value.
npm run test -- packages/core/src/__tests__/animation.test.ts