INNER CODE UNIT · TypeScript
friction
terrysahaidak/react-native-gallery-toolkit · packages/common/src/common.ts:23
export function friction(value: number) {
'worklet';
const MAX_FRICTION = 30;
const MAX_VALUE = 200;
const res = Math.max(
1,
Math.min(
MAX_FRICTION,
1 + (Math.abs(value) * (MAX_FRICTION - 1)) / MAX_VALUE,
),
);
if (value < 0) {
return -res;
}