none
WPF动画运行问题 RRS feed

  • 问题

  • private void ExcuteFlipStoryboard(UIElement ele)
            {
                Storyboard flipStoryboard = new Storyboard();

                PointAnimationUsingKeyFrames originFrames = new PointAnimationUsingKeyFrames();

                EasingPointKeyFrame originFrame = new EasingPointKeyFrame();
                originFrame.KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0,0,0));
                originFrame.Value = new Point(0.5, 0.5);

                originFrames.KeyFrames.Add(originFrame);
                

                DoubleAnimationUsingKeyFrames scaleXFrames = new DoubleAnimationUsingKeyFrames();

                EasingDoubleKeyFrame scaleXFrameStart = new EasingDoubleKeyFrame();
                scaleXFrameStart.KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 0));
                scaleXFrameStart.Value = -1;
                scaleXFrameStart.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };

                EasingDoubleKeyFrame scaleXFrameEnd = new EasingDoubleKeyFrame();
                scaleXFrameEnd.KeyTime = KeyTime.FromTimeSpan(new TimeSpan(0, 0, 1));
                scaleXFrameEnd.Value = 1;
                scaleXFrameEnd.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };

                scaleXFrames.KeyFrames.Add(scaleXFrameStart);
                scaleXFrames.KeyFrames.Add(scaleXFrameEnd);

                flipStoryboard.Children.Add(originFrames);
                flipStoryboard.Children.Add(scaleXFrames);

                Storyboard.SetTarget(originFrames, ele);
                Storyboard.SetTarget(scaleXFrames, ele);

                Storyboard.SetTargetProperty(originFrames, new PropertyPath("(UIElement.RenderTransformOrigin)", new object[] { }));

                Storyboard.SetTargetProperty(originFrames, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)", new object[] { }));

                flipStoryboard.Completed += delegate
                { };

                flipStoryboard.Begin();

            }
    Storyboard.SetTargetProperty(originFrames, new PropertyPath("(UIElement.RenderTransformOrigin)", new object[] { }));

                Storyboard.SetTargetProperty(originFrames, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)", new object[] { }));
    这个属性设置是不是错了

    Swat

    2012年9月5日 15:47

答案

全部回复