UNPKG

@madeja-studio/telar

Version:

UI component library by Madeja Studio

18 lines (17 loc) 395 B
/** * This interpolation is used for pan gestures where we want the panned node to * feel like it's fighting a resistance that prevents it from moving further. */ export const withDrag = ({ threshold, value, }: { threshold: number; value: number; }) => { if (value > threshold) { return threshold + (value - threshold) * (threshold / value); } else { return value; } };