20230724_MBJC_upperpc/MainWindow.xaml.cs

77 lines
2.6 KiB
C#
Raw Normal View History

2023-10-24 02:41:55 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
2023-11-13 07:46:12 +00:00
using System.Threading;
2023-10-24 02:41:55 +00:00
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
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
2023-11-13 07:46:12 +00:00
public Single single { get; set; } = new Single();
//Single single = new Single();
2023-10-24 02:41:55 +00:00
public MainWindow()
{
InitializeComponent();
2023-11-13 07:46:12 +00:00
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<Single> { 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<Single> 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;
//}
});
2023-10-24 02:41:55 +00:00
}
}
}