react-native-animated-look-up-table
Creates a look up table which can be used to interpolate across the results of an arbitrary input function. This can be used to help achieve some complex effects whilst maintaining performance, since they can be used in conjunction with useNativeDriver
.
🚀 Getting Started
Using npm
:
npm install --save react-native-animated-look-up-table
Using yarn
:
yarn add react-native-animated-look-up-table
✍️ Usage
This library exports the function createTransform
, which can be used to compile your animated look up table:
; // XXX: Create a sine wave between [0, 1] using 1024 samples.const sine = ;
Once generated, you can pass this to an Animated.Value
's interpolate
function:
<AnimatedView style= transform: // Interpolate animValue using the compiled transform. scale: animValue />
Since we're interpolating between samples, your look up table will smoothly transition between defined entries of your complex function.