Tada animation — playful wobble effect.
Implementation:
1import { Animated } from "react-native";23function TadaView({ children }) {4 const tadaAnim = useRef(new Animated.Value(0)).current;56 useEffect(() => {7 Animated.sequence([8 Animated.timing(tadaAnim, {9 toValue: 1,10 duration: 100,11 useNativeDriver: true,12 }),13 Animated.timing(tadaAnim, {14 toValue: -0.2,15 duration: 100,16 useNativeDriver: true,17 }),18 Animated.timing(tadaAnim, {19 toValue: 0.2,20 duration: 100,21 useNativeDriver: true,22 }),23 Animated.timing(tadaAnim, {24 toValue: -0.1,25 duration: 100,26 useNativeDriver: true,27 }),28 Animated.timing(tadaAnim, {29 toValue: 0.1,30 duration: 100,31 useNativeDriver: true,32 }),33 Animated.timing(tadaAnim, {34 toValue: 0,35 duration: 100,36 useNativeDriver: true,37 }),38 ]).start();39 }, []);4041 return (42 <Animated.View style={{43 transform: [44 { scale: tadaAnim.interpolate({45 inputRange: [0, 1],46 outputRange: [1, 1.1],47 }) },48 { rotate: tadaAnim.interpolate({49 inputRange: [-0.2, 0, 0.2],50 outputRange: ["-2deg", "0deg", "2deg"],51 }) },52 ],53 }}>54 {children}55 </Animated.View>56 );57}