react-native-sortables
Version:
Powerful Sortable Components for Flexible Content Reordering in React Native
19 lines (16 loc) • 511 B
text/typescript
import { Extrapolation, interpolate } from 'react-native-reanimated';
import type { Vector } from '../../../types/layout';
export const interpolateVector = (
progress: number,
from: Vector,
to: Vector,
extrapolation?: Extrapolation
) => {
'worklet';
const inputRange = [0, 1];
const extrapolate = extrapolation ?? Extrapolation.CLAMP;
return {
x: interpolate(progress, inputRange, [from.x, to.x], extrapolate),
y: interpolate(progress, inputRange, [from.y, to.y], extrapolate)
};
};