import { useEffect } from 'react';
import { StyleSheet, View } from 'react-native';
import {
useAnimatedStyle,
useSharedValue,
withRepeat,
withTiming, // 确保导入了 withTiming
} from 'react-native-reanimated';
import Animated from 'react-native-reanimated';
import Svg, { Path, Rect } from 'react-native-svg';
const BatterySvg = () => (
);
const RippleEffectBatteryIcon = () => {
const scaleValue = useSharedValue(1);
const opacityValue = useSharedValue(1);
useEffect(() => {
scaleValue.value = withRepeat(withTiming(3, { duration: 2000 }), -1, false); // 使用 withTiming
opacityValue.value = withRepeat(withTiming(0, { duration: 2000 }), -1, false); // 使用 withTiming
}, []);
const animatedCircle = useAnimatedStyle(() => {
return {
transform: [{ scale: scaleValue.value }],
opacity: opacityValue.value
};
});
return (
);
};
export default RippleEffectBatteryIcon;
const styles = StyleSheet.create({
container: {
position: 'relative',
width: 40,
height: 40,
},
batteryContainer: {
position: 'absolute',
zIndex: 2,
},
innerCircle: {
width: 40,
height: 40,
borderRadius: 20,
backgroundColor: '#025c72',
position: 'absolute',
zIndex: 1,
}
});