0

I use this function for rotating my image:

    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);
    }

The problem is when I try to rotate it again towards the opposite direction, it will rotate the original image, while I want to rotate the new one.

Any ideas?

Hamzeh Soboh
  • 7,572
  • 5
  • 43
  • 54

0 Answers0