import React from 'react';
import { Animated, Easing, View, StyleSheet } from 'react-native';
import Svg, { Path, Ellipse, Circle } from 'react-native-svg';
import { theme } from '../theme';
interface ZenCenterProps {
isPlaying: boolean;
}
const ZenFigure = () => (
);
export const ZenCenter: React.FC = ({ isPlaying }) => {
const orbitAnimPrimary = React.useRef(new Animated.Value(0)).current;
const orbitAnimSecondary = React.useRef(new Animated.Value(0)).current;
const starBreathPrimary = React.useRef(new Animated.Value(0)).current;
const starBreathSecondary = React.useRef(new Animated.Value(0)).current;
const solarHaloAnim = React.useRef(new Animated.Value(0)).current;
React.useEffect(() => {
orbitAnimPrimary.setValue(0);
orbitAnimSecondary.setValue(0);
starBreathPrimary.setValue(0);
starBreathSecondary.setValue(0);
solarHaloAnim.setValue(0);
const primaryLoop = Animated.loop(
Animated.timing(orbitAnimPrimary, {
toValue: 1,
duration: 18000,
easing: Easing.linear,
useNativeDriver: true,
})
);
const secondaryLoop = Animated.loop(
Animated.timing(orbitAnimSecondary, {
toValue: 1,
duration: 26000,
easing: Easing.linear,
useNativeDriver: true,
})
);
const primaryBreathLoop = Animated.loop(
Animated.sequence([
Animated.timing(starBreathPrimary, {
toValue: 1,
duration: 4200,
easing: Easing.inOut(Easing.quad),
useNativeDriver: true,
}),
Animated.timing(starBreathPrimary, {
toValue: 0,
duration: 4200,
easing: Easing.inOut(Easing.quad),
useNativeDriver: true,
}),
])
);
const secondaryBreathLoop = Animated.loop(
Animated.sequence([
Animated.timing(starBreathSecondary, {
toValue: 1,
duration: 6100,
easing: Easing.inOut(Easing.quad),
useNativeDriver: true,
}),
Animated.timing(starBreathSecondary, {
toValue: 0,
duration: 6100,
easing: Easing.inOut(Easing.quad),
useNativeDriver: true,
}),
])
);
const solarHaloLoop = Animated.loop(
Animated.timing(solarHaloAnim, {
toValue: 1,
duration: 210000,
easing: Easing.linear,
useNativeDriver: true,
})
);
primaryLoop.start();
secondaryLoop.start();
primaryBreathLoop.start();
secondaryBreathLoop.start();
solarHaloLoop.start();
return () => {
primaryLoop.stop();
secondaryLoop.stop();
primaryBreathLoop.stop();
secondaryBreathLoop.stop();
solarHaloLoop.stop();
};
}, [orbitAnimPrimary, orbitAnimSecondary, solarHaloAnim, starBreathPrimary, starBreathSecondary]);
const primaryRotate = orbitAnimPrimary.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '360deg'],
});
const secondaryRotate = orbitAnimSecondary.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '-360deg'],
});
const primaryStarOpacity = starBreathPrimary.interpolate({
inputRange: [0, 1],
outputRange: [0.45, 0.9],
});
const primaryStarScale = starBreathPrimary.interpolate({
inputRange: [0, 1],
outputRange: [0.92, 1.14],
});
const secondaryStarOpacity = starBreathSecondary.interpolate({
inputRange: [0, 1],
outputRange: [0.16, 0.55],
});
const secondaryStarScale = starBreathSecondary.interpolate({
inputRange: [0, 1],
outputRange: [0.9, 1.2],
});
const haloRotate = solarHaloAnim.interpolate({
inputRange: [0, 1],
outputRange: ['0deg', '360deg'],
});
const haloOpacity = solarHaloAnim.interpolate({
inputRange: [0, 0.12, 0.18, 0.26, 0.62, 0.72, 0.8, 1],
outputRange: [0.02, 0.03, 0.12, 0.04, 0.03, 0.11, 0.04, 0.02],
});
const haloScale = solarHaloAnim.interpolate({
inputRange: [0, 0.18, 0.62, 0.72, 1],
outputRange: [0.88, 1.06, 0.9, 1.08, 0.88],
});
return (
{/* Zen glow */}
{/* Zen waves */}
{/* Zen figure */}
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
orbitWrap: {
width: 220,
height: 220,
justifyContent: 'center',
alignItems: 'center',
},
orbitLayerPrimary: {
position: 'absolute',
width: 220,
height: 220,
justifyContent: 'center',
alignItems: 'center',
},
orbitLayerSecondary: {
position: 'absolute',
width: 256,
height: 256,
justifyContent: 'center',
alignItems: 'center',
},
solarHaloTrack: {
position: 'absolute',
width: 320,
height: 320,
justifyContent: 'center',
alignItems: 'center',
},
solarHalo: {
position: 'absolute',
top: -18,
right: 24,
width: 92,
height: 92,
borderRadius: 46,
backgroundColor: 'rgba(232,184,109,0.14)',
shadowColor: theme.colors.primary,
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0.18,
shadowRadius: 24,
elevation: 8,
justifyContent: 'center',
alignItems: 'center',
},
solarCore: {
width: 26,
height: 26,
borderRadius: 13,
backgroundColor: 'rgba(255,244,214,0.28)',
},
orbitRing: {
position: 'absolute',
width: 220,
height: 220,
borderRadius: 110,
borderWidth: 1,
borderColor: 'rgba(232,184,109,0.12)',
},
orbitRing2: {
position: 'absolute',
width: 256,
height: 256,
borderRadius: 128,
borderWidth: 1,
borderColor: 'rgba(232,184,109,0.06)',
},
orbitDot1: {
position: 'absolute',
top: -3,
left: 107,
width: 6,
height: 6,
borderRadius: 3,
backgroundColor: theme.colors.primary,
opacity: 0.55,
},
orbitDot1Trail: {
position: 'absolute',
top: 26,
right: 30,
width: 3,
height: 3,
borderRadius: 1.5,
backgroundColor: theme.colors.primary,
opacity: 0.22,
},
orbitDot2: {
position: 'absolute',
bottom: -2,
left: 127,
width: 4,
height: 4,
borderRadius: 2,
backgroundColor: theme.colors.primary,
opacity: 0.3,
},
orbitDot3: {
position: 'absolute',
top: 36,
left: 18,
width: 5,
height: 5,
borderRadius: 2.5,
backgroundColor: theme.colors.primary,
opacity: 0.18,
},
zenGlow: {
position: 'absolute',
width: 160,
height: 160,
borderRadius: 80,
backgroundColor: theme.colors.primarySoft,
opacity: 0,
},
zenWaves: {
position: 'absolute',
width: 220,
height: 220,
justifyContent: 'center',
alignItems: 'center',
},
zenWave: {
position: 'absolute',
width: 160,
height: 160,
borderRadius: 80,
borderWidth: 1,
borderColor: 'rgba(232,184,109,0.08)',
},
zenFigure: {
width: 140,
height: 140,
},
zenSvg: {
width: '100%',
height: '100%',
},
});