managarten/memoro/apps/mobile/components/molecules/LogoSpinnerAnimation.tsx
Till-JS e7f5f942f3 chore: initial commit - consolidate 4 projects into monorepo
Projects included:
- maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing)
- manacore (Expo mobile + SvelteKit web + Astro landing)
- manadeck (NestJS backend + Expo mobile + SvelteKit web)
- memoro (Expo mobile + SvelteKit web + Astro landing)

This commit preserves the current state before monorepo restructuring.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-22 23:38:24 +01:00

96 lines
2.5 KiB
TypeScript

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 (
<View style={[{ alignItems: 'center', justifyContent: 'center', width: size, height: size }, style]}>
{/* Rotierender Ring */}
<Animated.View
style={{
position: 'absolute',
width: size,
height: size,
borderRadius: size / 2,
borderWidth: ringThickness,
borderColor: 'transparent',
borderTopColor: logoColor,
borderRightColor: logoColor,
opacity: 0.6,
transform: [{ rotate }],
}}
/>
{/* Logo in der Mitte */}
<Animated.View
style={{
transform: [{ scale: scaleAnim }],
}}>
<MemoroLogo size={logoSize} color={logoColor} />
</Animated.View>
</View>
);
}