I am using react-native-reanimated in my react-native app. But I would like to transition my animations to moti.
I have a text I am animating based on the scroll position of my flatlist. By using the useAnimatedStyle hook, I can interpolate the scroll position input:
const animatedFontSize = useAnimatedStyle(() => ({
fontSize: interpolate(scrollPosition.value, [0, maximumScrollHeight], [18, 12], {
extrapolateRight: Extrapolation.CLAMP
})
}))
return (
<Animated.Text style={[animatedFontSize]}>
{my text}
</Animated.Text>
)
Can anyone help me to convert this dynamic animation to Moti? Most of the examples on the Moti site show rather "static" animations occurring once (e.g on mount/unmount). There is also the hook useDynamicAnimation. But how can I use it with an animation driven by a shared value?