当前位置: 首页>>代码示例>>C#>>正文


C# DoubleAnimationUsingKeyFrames.Freeze方法代码示例

本文整理汇总了C#中System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames.Freeze方法的典型用法代码示例。如果您正苦于以下问题:C# DoubleAnimationUsingKeyFrames.Freeze方法的具体用法?C# DoubleAnimationUsingKeyFrames.Freeze怎么用?C# DoubleAnimationUsingKeyFrames.Freeze使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames的用法示例。


在下文中一共展示了DoubleAnimationUsingKeyFrames.Freeze方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupAnimationForGear

        private void SetupAnimationForGear(Canvas gearBox, double ratio, SweepDirection direction)
        {
            var duration = TimeSpan.FromMilliseconds(30000*ratio);

            var animationRotation = new DoubleAnimationUsingKeyFrames
                                        {
                                            Duration = new Duration(duration),
                                            RepeatBehavior = RepeatBehavior.Forever
                                        };

            animationRotation.KeyFrames.Add(new LinearDoubleKeyFrame(0, KeyTime.FromPercent(0)));
            animationRotation.KeyFrames.Add(new LinearDoubleKeyFrame(
                                                direction == SweepDirection.Clockwise ? 360 : -360,
                                                KeyTime.FromPercent(1)));

            var rotateTransform = new RotateTransform();
            gearBox.RenderTransform = rotateTransform;
            gearBox.RenderTransformOrigin = new Point(0.5, 0.5);

            Storyboard.SetTarget(animationRotation, rotateTransform);
            Storyboard.SetTargetProperty(animationRotation, new PropertyPath(RotateTransform.AngleProperty));

            animationRotation.Freeze();

            _storyBoard.Children.Add(animationRotation);
        }
开发者ID:ernstnaezer,项目名称:Manssiere,代码行数:26,代码来源:LoonyGears.xaml.cs

示例2: InitializeRotations

        private void InitializeRotations()
        {
            _storyBoard.RepeatBehavior = RepeatBehavior.Forever;
            var duration = TimeSpan.FromSeconds(10);

            var animationRotation = new DoubleAnimationUsingKeyFrames
                                        {
                                            Duration = new Duration(duration),
                                            RepeatBehavior = RepeatBehavior.Forever
                                        };

            var animationTranslate = new PennerDoubleAnimation
                                         {
                                             Equation = PennerDoubleAnimation.Equations.QuadEaseInOut,
                                             Duration = TimeSpan.FromSeconds(5),
                                             RepeatBehavior = RepeatBehavior.Forever,
                                             From = 0,
                                             To = 610,
                                             AutoReverse = true
                                         };

            animationRotation.KeyFrames.Add(new LinearDoubleKeyFrame(0, KeyTime.FromPercent(0)));
            animationRotation.KeyFrames.Add(new LinearDoubleKeyFrame(360, KeyTime.FromPercent(1)));

            var rotateTransform = new RotateTransform();
            PullPoint.RenderTransform = rotateTransform;
            PullPoint.RenderTransformOrigin = new Point(0.5, 0.5);

            var translateTransform = new TranslateTransform();
            Yoke.RenderTransform = translateTransform;
            Yoke.RenderTransformOrigin = new Point(0.5,0.5);

            Storyboard.SetTarget(animationRotation, rotateTransform);
            Storyboard.SetTargetProperty(animationRotation, new PropertyPath(RotateTransform.AngleProperty));

            Storyboard.SetTarget(animationTranslate, translateTransform);
            Storyboard.SetTargetProperty(animationTranslate, new PropertyPath(TranslateTransform.XProperty));

            animationTranslate.Freeze();
            animationRotation.Freeze();

            _storyBoard.Children.Add(animationTranslate);
            _storyBoard.Children.Add(animationRotation);
        }
开发者ID:ernstnaezer,项目名称:Manssiere,代码行数:44,代码来源:ScotchYokeUserControl.xaml.cs


注:本文中的System.Windows.Media.Animation.DoubleAnimationUsingKeyFrames.Freeze方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。