import { Image } from 'expo-image'; import { useEffect } from 'react'; import { StyleSheet, useWindowDimensions, View } from 'react-native'; import Animated, { Easing, useAnimatedStyle, useSharedValue, withRepeat, withTiming } from 'react-native-reanimated'; import { colors } from '@/lib/theme'; const AnimatedImage = Animated.createAnimatedComponent(Image); /** Two soft colour blobs drifting slowly behind the content, so screens never feel static. */ export function AmbientBackground() { const { width, height } = useWindowDimensions(); const t = useSharedValue(0); useEffect(() => { t.set(withRepeat(withTiming(1, { duration: 18000, easing: Easing.inOut(Easing.sin) }), -1, true)); }, [t]); const size = Math.max(width, height) * 0.9; const purple = useAnimatedStyle(() => ({ transform: [{ translateX: -size * 0.35 + t.value * width * 0.35 }, { translateY: -size * 0.3 + t.value * height * 0.12 }], })); const blue = useAnimatedStyle(() => ({ transform: [{ translateX: width - size * 0.6 - t.value * width * 0.3 }, { translateY: height - size * 0.55 - t.value * height * 0.1 }], })); return ( ); } const styles = StyleSheet.create({ blob: { position: 'absolute', top: 0, left: 0, opacity: 0.45 }, });