2012-06-15 160 views
0

嗯,我想房子圖像旋轉從-5°,我寫了下面的代碼故事板C#動畫

 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 :)

回答