Wobble animation — shaking wobble effect.
Implementation:
1import { Animated, Easing } from "react-native";23function WobbleView({ children }) {4 const wobbleAnim = useRef(new Animated.Value(0)).current;56 useEffect(() => {7 Animated.loop(8 Animated.sequence([9 Animated.timing(wobbleAnim, {10 toValue: 1,11 duration: 100,12 easing: Easing.linear,13 useNativeDriver: true,14 }),15 Animated.timing(wobbleAnim, {16 toValue: -1,17 duration: 100,18 easing: Easing.linear,19 useNativeDriver: true,20 }),21 ])22 ).start();23 }, []);2425 const rotate = wobbleAnim.interpolate({26 inputRange: [-1, 0, 1],27 outputRange: ["-5deg", "0deg", "5deg"],28 });2930 return (31 <Animated.View style={{ transform: [{ rotate }] }}>32 {children}33 </Animated.View>34 );35}