私は にrotating
いbutton
ます。問題なく動作click
し180 degree
ています
AnimationServices.RotationAnimation((FrameworkElement)sender, 180, 1, "Y"); // working
しかし、同じことを90度の角度rotating
で2回行うと、機能しなくなります
AnimationServices.RotationAnimation((FrameworkElement)sender, 90, 1, "Y");
AnimationServices.RotationAnimation((FrameworkElement)sender, 90, 1, "Y"); // not working
その唯一rotating
の90 degree
角度で
誰かがこの奇妙な問題について何か考えを持っていますか?
アップデート
internal static void RotationAnimation(FrameworkElement sender, int Angle, int DurationInMSec, String Axis)
{
var storyboard = new Storyboard();
var easingDoubleKeyFrame1 = new EasingDoubleKeyFrame
{
KeyTime = TimeSpan.FromMilliseconds(0),
Value = 0
};
var easingDoubleKeyFrame2 = new EasingDoubleKeyFrame
{
KeyTime = TimeSpan.FromMilliseconds(DurationInMSec),
Value = Angle
};
var doubleAnimationUsingKeyFrames = new DoubleAnimationUsingKeyFrames();
doubleAnimationUsingKeyFrames.KeyFrames.Add(easingDoubleKeyFrame1);
doubleAnimationUsingKeyFrames.KeyFrames.Add(easingDoubleKeyFrame2);
var rotateTransform = new PlaneProjection();
var button = (FrameworkElement)sender;
button.Projection = rotateTransform;
Storyboard.SetTarget(doubleAnimationUsingKeyFrames, rotateTransform);
Storyboard.SetTargetProperty(doubleAnimationUsingKeyFrames, new PropertyPath("Rotation" + Axis));
storyboard.Children.Add(doubleAnimationUsingKeyFrames);
storyboard.Begin();
}