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)
{
Random _rand = new Random();
// 初始化进度
PkBar.LeftProgress = 0.5; // 左右各占50%
await Task.Delay(500);
//Random _rand = new Random();
//// 初始化进度
//PkBar.LeftProgress = 0.5; // 左右各占50%
//await Task.Delay(500);
for (int i = 0; i < 20; i++)
{
await Task.Delay(300);
//for (int i = 0; i < 500; i++)
//{
// await Task.Delay(300);
// 随机生成一个变化值 0~0.1
double delta = _rand.NextDouble() * 0.1;
// // 随机生成一个变化值 0~0.1
// double delta = _rand.NextDouble() * 0.1;
// 随机决定左增加还是右增加
if (_rand.Next(0, 2) == 0)
{
// 左增加 → 右减少
PkBar.LeftProgress = Math.Min(1, PkBar.LeftProgress + delta);
}
else
{
// 右增加 → 左减少
PkBar.RightProgress = Math.Min(1, PkBar.RightProgress + delta);
}
}
// // 随机决定左增加还是右增加
// if (_rand.Next(0, 2) == 0)
// {
// // 左增加 → 右减少
// PkBar.LeftProgress = Math.Min(1, PkBar.LeftProgress + delta);
// }
// else
// {
// // 右增加 → 左减少
// PkBar.RightProgress = Math.Min(1, PkBar.RightProgress + delta);
// }
//}
DrawCirclesWithText();
// 播放音乐