在wp7 silverlight中多次旋转相同的图像

时间:2012-11-28 08:15:07

标签: silverlight windows-phone-7 animation image-rotation

我使用此功能旋转图像:

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

问题是,当我尝试再向相反方向旋转时,它会旋转原始图像,而我想旋转新图像。

有什么想法吗?

0 个答案:

没有答案