この関数を使用して画像を回転させます。
public void rotateMe(Image img, double duration, int degrees, double xPoint, double yPoint)
{
Duration Time_duration = new Duration(TimeSpan.FromSeconds(duration));
Storyboard MyStory = new Storyboard();
MyStory.Duration = Time_duration;
DoubleAnimation My_Double = new DoubleAnimation();
My_Double.Duration = Time_duration;
MyStory.Children.Add(My_Double);
RotateTransform MyTransform = new RotateTransform();
Storyboard.SetTarget(My_Double, MyTransform);
Storyboard.SetTargetProperty(My_Double, new PropertyPath("Angle"));
My_Double.To = degrees;
img.RenderTransform = MyTransform;
img.RenderTransformOrigin = new System.Windows.Point(xPoint, yPoint);
MyStory.Begin();
MyStory.Completed += new EventHandler(MyStory_Completed);
}
問題は、反対方向に再度回転しようとすると、新しい画像を回転させたいときに元の画像が回転することです。
何か案は?