故事板c#动画

时间:2012-06-15 21:19:43

标签: c# xaml silverlight-4.0 storyboard

好吧,我希望家庭图片从-5°转到,我写了以下代码

        Duration duration2 = new Duration(TimeSpan.FromSeconds(1));

        Storyboard sb2 = new Storyboard();
        sb2.Duration = duration2;

        DoubleAnimation da2 = new DoubleAnimation();
        da2.Duration = duration2;

        sb2.Children.Add(da2);

        RotateTransform rt2 = new RotateTransform();

        Storyboard.SetTarget(da2, rt2);
        Storyboard.SetTargetProperty(da2, new PropertyPath("Angle"));
        da2.From = 5;
        da2.To = -5;

        HouseImg.RenderTransform = rt2;
        HouseImg.RenderTransformOrigin = new Point(0.5, 0.5);

        sb2.RepeatBehavior = RepeatBehavior.Forever;
        sb2.Begin();

但是当它结束时,它会快速地开始(),我想要的也是动画。 总结一下:我想从-5°以及从-5°制作动画。

Tnx:)

1 个答案:

答案 0 :(得分:1)

AutoReverse属性设置为true

sb2.AutoReverse = true;