C# WPF中的平移变换和旋转

C# WPF中的平移变换和旋转,c#,wpf,C#,Wpf,翻译很好,但是没有旋转,你能帮我吗 TranslateTransform trans = new TranslateTransform(); Pointer.RenderTransform = trans; DoubleAnimation animX = new DoubleAnimation(fromX, toX, TimeSpan.FromMilliseconds(325)); DoubleAnimation animY = new DoubleAnimation(fromY, toY,

翻译很好,但是没有旋转,你能帮我吗

TranslateTransform trans = new TranslateTransform();

Pointer.RenderTransform = trans;

DoubleAnimation animX = new DoubleAnimation(fromX, toX, TimeSpan.FromMilliseconds(325));
DoubleAnimation animY = new DoubleAnimation(fromY, toY, TimeSpan.FromMilliseconds(325));

DoubleAnimation rotateBy = new DoubleAnimation(0, 90, TimeSpan.FromMilliseconds(325));

animX.EasingFunction = new SineEase { EasingMode = EasingMode.EaseInOut };
animY.EasingFunction = new SineEase { EasingMode = EasingMode.EaseInOut };

animX.Completed += new EventHandler(myanim_Completed);
trans.BeginAnimation(TranslateTransform.XProperty, animX);
trans.BeginAnimation(TranslateTransform.YProperty, animY);

trans.BeginAnimation(RotateTransform.AngleProperty, rotateBy);

TranslateTransform
没有
Angle
属性。您应该使用
转换组

var group = new TransformGroup();
var trans = new TranslateTransform();
group.Children.Add(trans);
var rotate = new RotateTransform();
group.Children.Add(rotate);

Pointer.RenderTransform = group;

// the rest of the code is fine; only the last line needs fixing:

rotate.BeginAnimation(RotateTransform.AngleProperty, rotateBy);

您还应该考虑使用
情节提要
对动画进行分组。

TranslateTransform
没有
角度
属性。您应该使用
转换组

var group = new TransformGroup();
var trans = new TranslateTransform();
group.Children.Add(trans);
var rotate = new RotateTransform();
group.Children.Add(rotate);

Pointer.RenderTransform = group;

// the rest of the code is fine; only the last line needs fixing:

rotate.BeginAnimation(RotateTransform.AngleProperty, rotateBy);

您还应该考虑使用
情节提要
对动画进行分组。

TranslateTransform
没有
角度
属性。您应该使用
转换组

var group = new TransformGroup();
var trans = new TranslateTransform();
group.Children.Add(trans);
var rotate = new RotateTransform();
group.Children.Add(rotate);

Pointer.RenderTransform = group;

// the rest of the code is fine; only the last line needs fixing:

rotate.BeginAnimation(RotateTransform.AngleProperty, rotateBy);

您还应该考虑使用
情节提要
对动画进行分组。

TranslateTransform
没有
角度
属性。您应该使用
转换组

var group = new TransformGroup();
var trans = new TranslateTransform();
group.Children.Add(trans);
var rotate = new RotateTransform();
group.Children.Add(rotate);

Pointer.RenderTransform = group;

// the rest of the code is fine; only the last line needs fixing:

rotate.BeginAnimation(RotateTransform.AngleProperty, rotateBy);
您还应该考虑使用
情节提要
对动画进行分组