Lynx/Modules/Motion
@sigx/lynx-motion · Stable

Motion#

Animation drivers for SignalX Lynx — withSpring, withTiming and animate, running on the main thread with progress observable from the background thread for free.

29k weekly v0.4.1 iOS · Android MIT

Installation#

Terminal
pnpm add @sigx/lynx-motion

Animate a shared value#

TSX
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:

TSX
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.