Jello animation — wobbly jello effect.
Implementation:
1import { Animated } from "react-native";23function JelloView({ children }) {4 const jelloAnim = useRef(new Animated.Value(0)).current;56 useEffect(() => {7 Animated.sequence([8 Animated.timing(jelloAnim, {9 toValue: 0.25,10 duration: 100,11 useNativeDriver: true,12 }),13 Animated.timing(jelloAnim, {14 toValue: -0.25,15 duration: 100,16 useNativeDriver: true,17 }),18 Animated.timing(jelloAnim, {19 toValue: 0.15,20 duration: 100,21 useNativeDriver: true,22 }),23 Animated.timing(jelloAnim, {24 toValue: -0.15,25 duration: 100,26 useNativeDriver: true,27 }),28 Animated.timing(jelloAnim, {29 toValue: 0,30 duration: 100,31 useNativeDriver: true,32 }),33 ]).start();34 }, []);3536 const scaleX = jelloAnim.interpolate({37 inputRange: [-0.25, 0, 0.25],38 outputRange: [0.9, 1, 1.1],39 });4041 return (42 <Animated.View style={{43 transform: [44 { skewX: jelloAnim.interpolate({45 inputRange: [-0.25, 0, 0.25],46 outputRange: ["-5deg", "0deg", "5deg"],47 }) },48 { scaleX },49 ],50 }}>51 {children}52 </Animated.View>53 );54}