This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SCALE = { | |
// this defines the terms of our scaling animation. | |
getScaleTransformationStyle(animated: Animated.Value, startSize: number = 1, endSize: number = 0.99) { | |
const interpolation = animated.interpolate({ | |
inputRange: [0, 1], | |
outputRange: [startSize, endSize], | |
}); | |
return { | |
transform: [ | |
{ scale: interpolation }, | |
], | |
}; | |
}, | |
// This defines animation behavior we expext onPressIn | |
pressInAnimation(animated: Animated.Value, duration: number = 150) { | |
animated.setValue(0); | |
Animated.timing(animated, { | |
toValue: 1, | |
duration, | |
useNativeDriver: true, | |
}).start(); | |
}, | |
// This defines animatiom behavior we expect onPressOut | |
pressOutAnimation(animated: Animated.Value, duration: number = 150) { | |
animated.setValue(1); | |
Animated.timing(animated, { | |
toValue: 0, | |
duration, | |
useNativeDriver: true, | |
}).start(); | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment