Jelly animation — squishy, jelly-like effect.
Implementation:
1import { Animated } from "react-native";23function JellyView({ children }) {4 const jellyAnim = useRef(new Animated.Value(1)).current;56 useEffect(() => {7 Animated.loop(8 Animated.sequence([9 Animated.timing(jellyAnim, {10 toValue: 1.1,11 duration: 300,12 useNativeDriver: true,13 }),14 Animated.timing(jellyAnim, {15 toValue: 0.9,16 duration: 300,17 useNativeDriver: true,18 }),19 Animated.timing(jellyAnim, {20 toValue: 1,21 duration: 300,22 useNativeDriver: true,23 }),24 ])25 ).start();26 }, []);2728 return (29 <Animated.View style={{30 transform: [31 { scaleX: jellyAnim },32 { scaleY: jellyAnim.interpolate({33 inputRange: [0.9, 1, 1.1],34 outputRange: [1.1, 1, 0.9],35 })},36 ],37 }}>38 {children}39 </Animated.View>40 );41}