using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace _20230724_MBJC_upperpc.Views
{
///
/// FirstPageView.xaml 的交互逻辑
///
public partial class FirstPageView : UserControl
{
public Single single { get; set; } = new Single();
public FirstPageView()
{
InitializeComponent();
this.DataContext = single;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
//for (int i = 0; i < 60; i++)
//{
// Thread.Sleep(100);
// Rotate_X += 1;
// Rotate_Y += 1;
// Rotate_Z += 1;
// Refresh();
//}
re(new List { new Single() { Rotate_X = -180, Rotate_Y = -90, Rotate_Z = 0 },
new Single() { Rotate_X = -90, Rotate_Y = -90, Rotate_Z = 0 },
new Single() { Rotate_X = -90, Rotate_Y = -180, Rotate_Z = 0 },
new Single() { Rotate_X = -90, Rotate_Y = -90, Rotate_Z = 0 },
new Single() { Rotate_X = -90, Rotate_Y = -90, Rotate_Z = 90 },
new Single() { Rotate_X = -90, Rotate_Y = -90, Rotate_Z = 0 }});
}
private async void re(List End)
{
await Task.Run(() =>
{
for (int i = 0; i < End.Count; i++)
{
float a = single.Rotate_X;
float b = single.Rotate_Y;
float c = single.Rotate_Z;
for (int j = 0; j < 100; j++)
{
Thread.Sleep(10);
single.Rotate_X += (End[i].Rotate_X - a) / 100;
single.Rotate_Y += (End[i].Rotate_Y - b) / 100;
single.Rotate_Z += (End[i].Rotate_Z - c) / 100;
}
}
//for (int i = 0; i < 6000; i++)
//{
// Thread.Sleep(1);
// //single.Rotate_X += 0.1f;
// single.Rotate_Y += 0.1f;
// //single.Rotate_Z += 0.1f;
//}
});
}
}
}