Motion
Animation drivers for SignalX Lynx — withSpring, withTiming and animate, running on the main thread with progress observable from the background thread for free.
Installation
pnpm add @sigx/lynx-motion
Animate a shared value
import { useSharedValue, useAnimatedStyle } from '@sigx/lynx';
import { withSpring } from '@sigx/lynx-motion';
const scale = useSharedValue(1);
const style = useAnimatedStyle(() => ({
transform: [{ scale: scale.value }],
}));
const onPress = () => { scale.value = withSpring(1.2); };
The spring solves on the main thread — no bridge round-trips per frame — while scale.value stays readable from your components like any signal.
Drivers
- withSpring — physics-based; configure mass, stiffness, damping
- withTiming — duration + easing curves
- animate — imperative sequences (
await animate(...))
With gestures
Motion and Gestures share SharedValues, so a pan can hand off into a spring with zero glue:
const pan = usePan((e) => { x.value = e.translationX; })
.onEnd(() => { x.value = withSpring(0); });
Next steps
See Usage for sequencing and interruption, or the API reference.
