Çoklu Animasyon -React Native Hooks ile Animasyon-4
1 min readMar 5, 2020
Çoklu animasyon ekleme: Bir nesneye birden fazla animasyon eklenebilir.Sırayla ya da aynı anda animasyon yürütülebilir.
Örnek :
const AnimasyonDeneme = () => {
const animationWidth = new Animated.Value(200);
const animationHeight = new Animated.Value(200); const startAnimation = () => {
Animated.timing(animationWidth, {
toValue: 300,
duration: 1000,
}).start(
//sırayla olmasını istediğimizde bu şekilde
/*
()=> Animated.timing(animationHeight, {
toValue: 100,
duration: 1000
}).start()
*/
);
//Aynı anda olmasını istediğimizde durumunda
Animated.timing(animationHeight, {
toValue: 100,
duration: 1000
}).start()
};
const animatedStyle = {
width: animationWidth,
height: animationHeight
};
return (
<View style={styles.container}>
<TouchableWithoutFeedback
onPress={() => startAnimation()}>
<Animated.View
style={[styles.myBox, animatedStyle]}>
<Text>Mâlâyaniyle iştigal, maksadı geri bırakır!</Text>
</Animated.View>
</TouchableWithoutFeedback>
</View>
)
};