feat: 测试

This commit is contained in:
jinyaqiu 2025-08-01 18:02:16 +08:00
parent d996b4dab6
commit 1fd3907ceb
2 changed files with 40 additions and 6 deletions

View File

@ -29,6 +29,9 @@ export default function HomeScreen() {
subtitle: new Animated.Value(0), // 副标题动画
}));
// 添加挥手动画值
const waveAnim = useRef(new Animated.Value(0)).current;
// 启动IP图标摇晃动画
const startShaking = () => {
// 停止任何正在进行的动画
@ -176,6 +179,31 @@ export default function HomeScreen() {
buttonLoopAnim.current.start();
};
// 启动挥手动画
const startWaveAnimation = () => {
// 创建循环动画:左右摇摆
Animated.loop(
Animated.sequence([
Animated.timing(waveAnim, {
toValue: 1,
duration: 500,
useNativeDriver: true,
}),
Animated.timing(waveAnim, {
toValue: -1,
duration: 500,
useNativeDriver: true,
}),
Animated.timing(waveAnim, {
toValue: 0,
duration: 500,
useNativeDriver: true,
}),
Animated.delay(1000), // 暂停1秒
])
).start();
};
// 组件挂载时启动动画
useEffect(() => {
setIsLoading(true);
@ -199,6 +227,8 @@ export default function HomeScreen() {
.then(() => startDescriptionAnimation())
.then(() => startButtonAnimation())
.catch(console.error);
// 启动挥手动画
startWaveAnimation();
});
// 组件卸载时清理动画
@ -231,6 +261,12 @@ export default function HomeScreen() {
],
};
// 旋转动画插值
const rotate = waveAnim.interpolate({
inputRange: [-1, 0, 1],
outputRange: ['-15deg', '0deg', '15deg'],
});
if (isLoading) {
return (
<View style={styles.loadingContainer}>
@ -309,7 +345,7 @@ export default function HomeScreen() {
{/* Animated IP */}
<View style={styles.ipContainer}>
<Animated.View style={[styles.ipWrapper, animatedStyle]}>
<Animated.View style={[styles.ipWrapper, { transform: [{ rotate }] }]}>
<IP />
</Animated.View>
</View>

View File

@ -1,9 +1,7 @@
import ConversationsSvg from '@/assets/icons/svg/conversations.svg';
import StoriesSvg from '@/assets/icons/svg/stories.svg';
import AskNavbar from '@/components/layout/ask';
import CarouselComponent from '@/components/owner/carousel';
import CreateCountComponent from '@/components/owner/createCount';
import Ranking from '@/components/owner/ranking';
import MemberCard from '@/components/owner/rights/memberCard';
import SettingModal from '@/components/owner/setting';
import UserInfo from '@/components/owner/userName';
@ -91,9 +89,9 @@ export default function OwnerPage() {
<MemberCard pro={userInfoDetails?.membership_level} />
{/* 分类 */}
<View style={{ marginHorizontal: -16, marginBottom: -16 }}>
{/* <View style={{ marginHorizontal: -16, marginBottom: -16 }}>
<CarouselComponent data={userInfoDetails?.material_counter} />
</View>
</View> */}
{/* 作品数据 */}
<View className='flex flex-row justify-between gap-[1rem]'>
@ -102,7 +100,7 @@ export default function OwnerPage() {
</View>
{/* 排行榜 */}
<Ranking data={userInfoDetails.title_rankings} />
{/* <Ranking data={userInfoDetails.title_rankings} /> */}
</View>
}
// 优化性能:添加 getItemLayout