This commit is contained in:
tanglong 2025-10-18 11:49:44 +08:00
parent 9b9e4c82a8
commit a4a54a2f69

View File

@ -59,30 +59,30 @@ namespace Wpf_AiSportsMicrospace.Views.JumpRope
private async void UserControl_Loaded(object sender, RoutedEventArgs e) private async void UserControl_Loaded(object sender, RoutedEventArgs e)
{ {
Random _rand = new Random(); //Random _rand = new Random();
// 初始化进度 //// 初始化进度
PkBar.LeftProgress = 0.5; // 左右各占50% //PkBar.LeftProgress = 0.5; // 左右各占50%
await Task.Delay(500); //await Task.Delay(500);
for (int i = 0; i < 20; i++) //for (int i = 0; i < 500; i++)
{ //{
await Task.Delay(300); // await Task.Delay(300);
// 随机生成一个变化值 0~0.1 // // 随机生成一个变化值 0~0.1
double delta = _rand.NextDouble() * 0.1; // double delta = _rand.NextDouble() * 0.1;
// 随机决定左增加还是右增加 // // 随机决定左增加还是右增加
if (_rand.Next(0, 2) == 0) // if (_rand.Next(0, 2) == 0)
{ // {
// 左增加 → 右减少 // // 左增加 → 右减少
PkBar.LeftProgress = Math.Min(1, PkBar.LeftProgress + delta); // PkBar.LeftProgress = Math.Min(1, PkBar.LeftProgress + delta);
} // }
else // else
{ // {
// 右增加 → 左减少 // // 右增加 → 左减少
PkBar.RightProgress = Math.Min(1, PkBar.RightProgress + delta); // PkBar.RightProgress = Math.Min(1, PkBar.RightProgress + delta);
} // }
} //}
DrawCirclesWithText(); DrawCirclesWithText();
// 播放音乐 // 播放音乐