mediumReact Native#148

Worklet-style interpolate and clamp

Prompt

The two math primitives inside every Reanimated gesture:

  1. clamp(value, lower, upper)
  2. interpolate(value, [inMin, inMax], [outMin, outMax], extrapolate) — linear mapping; extrapolate is 'extend' (default, keep the line going) or 'clamp' (pin to the output range)

Example: drag progress 0→1 mapping to translateY 0→−300.

Hints

Solution

Your Code

15 min

Tests

Click Run to test your code