import React, { useEffect, useRef } from 'react'; import { View, Animated, ViewStyle } from 'react-native'; import MemoroLogo from '~/components/atoms/MemoroLogo'; import { useTheme } from '~/features/theme/ThemeProvider'; interface LogoSpinnerAnimationProps { size?: number; style?: ViewStyle; color?: string; } /** * MemoroLogo mit rotierendem Ring * Perfekte Balance zwischen Branding und Loading-Indikator */ export function LogoSpinnerAnimation({ size = 100, style, color }: LogoSpinnerAnimationProps) { const { colors } = useTheme(); const rotateAnim = useRef(new Animated.Value(0)).current; const scaleAnim = useRef(new Animated.Value(1)).current; const logoColor = color || colors.primary; const logoSize = size * 0.4; // Logo ist 40% der Gesamtgröße - mehr Abstand zum Ring const ringThickness = 5; // Dickerer Ring für bessere Sichtbarkeit useEffect(() => { // Rotation für den Ring const rotateAnimation = Animated.loop( Animated.timing(rotateAnim, { toValue: 1, duration: 1500, useNativeDriver: true, }) ); // Subtiler Pulse für das Logo const pulseAnimation = Animated.loop( Animated.sequence([ Animated.timing(scaleAnim, { toValue: 1.05, duration: 1500, useNativeDriver: true, }), Animated.timing(scaleAnim, { toValue: 1, duration: 1500, useNativeDriver: true, }), ]) ); rotateAnimation.start(); pulseAnimation.start(); return () => { rotateAnimation.stop(); pulseAnimation.stop(); }; }, [rotateAnim, scaleAnim]); const rotate = rotateAnim.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '360deg'], }); return ( {/* Rotierender Ring */} {/* Logo in der Mitte */} ); }