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


C# FrameworkElement.AnimateProperty方法代码示例

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


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

示例1: CreateAnimation

        public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
        {
            var transform = GetTransform(element);

            var list = new List<Timeline>
            {
                element.AnimateProperty(AnimationProperty.Opacity)
                    .AddEasingKeyFrame(0.0, 0)
                    .AddEasingKeyFrame(Duration, 1),
            };
            if (Math.Abs(DistanceX) > 0)
            {
                list.Add(
                    element.AnimateProperty(AnimationProperty.TranslateX)
                        .AddEasingKeyFrame(0.0, transform.TranslateX + DistanceX)
                        .AddEasingKeyFrame(Duration, transform.TranslateX, new CubicEase()));
            }
            if (Math.Abs(DistanceY) > 0)
            {
                list.Add(
                    element.AnimateProperty(AnimationProperty.TranslateY)
                        .AddEasingKeyFrame(0.0, transform.TranslateY + DistanceY)
                        .AddEasingKeyFrame(Duration, transform.TranslateY, new CubicEase()));
            }

            return list;
        }
开发者ID:uwper,项目名称:AnimationManager,代码行数:27,代码来源:FadeAnimations.cs

示例2: CreateAnimation

        public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
        {
            var transform = GetTransform(element);

            var animations = new List<Timeline>();
            if (Math.Abs(DistanceY) > 0.001)
                animations.Add(
                    element.AnimateProperty(AnimationProperty.TranslateY)
                        .AddEasingKeyFrame(0.0, transform.TranslateY)
                        .AddEasingKeyFrame(Duration * 0.2, transform.TranslateY)
                        .AddEasingKeyFrame(Duration * 0.4, transform.TranslateY + DistanceY)
                        .AddEasingKeyFrame(Duration * 0.5, transform.TranslateY)
                        .AddEasingKeyFrame(Duration * 0.6, transform.TranslateY + (DistanceY / 2))
                        .AddEasingKeyFrame(Duration * 0.8, transform.TranslateY)
                        .AddEasingKeyFrame(Duration, transform.TranslateY)
                    );
            if (Math.Abs(DistanceX) > 0.001)
                animations.Add(
                    element.AnimateProperty(AnimationProperty.TranslateX)
                        .AddEasingKeyFrame(0.0, transform.TranslateX)
                        .AddEasingKeyFrame(Duration * 0.2, transform.TranslateX)
                        .AddEasingKeyFrame(Duration * 0.4, transform.TranslateX + DistanceX)
                        .AddEasingKeyFrame(Duration * 0.5, transform.TranslateX)
                        .AddEasingKeyFrame(Duration * 0.6, transform.TranslateX + (DistanceX / 2))
                        .AddEasingKeyFrame(Duration * 0.8, transform.TranslateX)
                        .AddEasingKeyFrame(Duration, transform.TranslateX)
                    );
            return animations;
        }
开发者ID:uwper,项目名称:AnimationManager,代码行数:29,代码来源:AttentionAnimations.cs

示例3: CreateAnimation

        public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
        {
            var transform = GetTransform(element);

            return new Timeline[]
            {
                element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
                    .AddDiscreteKeyFrame(0.0, new Point(0, 1)),

                element.AnimateProperty(AnimationProperty.Opacity)
                    .AddEasingKeyFrame(0.0, 0)
                    .AddEasingKeyFrame(Duration, 1),

                element.AnimateProperty(AnimationProperty.TranslateX)
                    .AddEasingKeyFrame(0.0, transform.TranslateX - 700)
                    .AddEasingKeyFrame(Duration*0.6, transform.TranslateX + 30, new QuadraticEase())
                    .AddEasingKeyFrame(Duration*0.8, transform.TranslateX),

                element.AnimateProperty(AnimationProperty.SkewX)
                    .AddEasingKeyFrame(0.0, 30)
                    .AddEasingKeyFrame(Duration*0.6, -30)
                    .AddEasingKeyFrame(Duration*0.8, 15)
                    .AddEasingKeyFrame(Duration, 0),
            };
        }
开发者ID:uwper,项目名称:AnimationManager,代码行数:25,代码来源:LightSpeedAnimations.cs

示例4: CreateAnimation

 public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
 {
     return new Timeline[]
     {
         element.AnimateProperty(AnimationProperty.Opacity)
             .AddDiscreteKeyFrame(0.0, 1),
         element.AnimateProperty(AnimationProperty.Rotation)
             .AddDiscreteKeyFrame(0.0, 0),
         element.AnimateProperty(AnimationProperty.TranslateX)
             .AddDiscreteKeyFrame(0.0, 0),
         element.AnimateProperty(AnimationProperty.TranslateY)
             .AddDiscreteKeyFrame(0.0, 0),
         element.AnimateProperty(AnimationProperty.ScaleX)
             .AddDiscreteKeyFrame(0.0, 1),
         element.AnimateProperty(AnimationProperty.ScaleY)
             .AddDiscreteKeyFrame(0.0, 1),
         element.AnimateProperty(AnimationProperty.RotationX)
             .AddDiscreteKeyFrame(0.0, 0),
         element.AnimateProperty(AnimationProperty.RotationY)
             .AddDiscreteKeyFrame(0.0, 0),
         element.AnimateProperty(AnimationProperty.RotationZ)
             .AddDiscreteKeyFrame(0.0, 0),
         element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
             .AddDiscreteKeyFrame(0.0, new Point(0.5, 0.5)),
     };
 }
开发者ID:uwper,项目名称:AnimationManager,代码行数:26,代码来源:ResetAnimation.cs

示例5: CreateAnimation

 public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
 {
     return new Timeline[]
     {
         element.AnimateProperty(AnimationProperty.CentreOfRotationX)
             .AddDiscreteKeyFrame(0.0, 0),
         element.AnimateProperty(AnimationProperty.RotationY)
             .AddEasingKeyFrame(0, 80)
             .AddEasingKeyFrame(Duration, 0, new QuadraticEase()),
         element.AnimateProperty(AnimationProperty.Opacity)
             .AddEasingKeyFrame(0.0, 1),
     };
 }
开发者ID:uwper,项目名称:AnimationManager,代码行数:13,代码来源:TurnstileAnimations.cs

示例6: CreateAnimation

        public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
        {
            var transform = GetTransform(element);

            if (Side == Side.Left)
                return new Timeline[]
                {
                    element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
                        .AddDiscreteKeyFrame(0.0, new Point(0,0)),

                    element.AnimateProperty(AnimationProperty.Rotation)
                        .AddEasingKeyFrame(0.0, 0, new CubicEase {EasingMode = EasingMode.EaseInOut})
                        .AddEasingKeyFrame(Duration*0.2, 80, new CubicEase {EasingMode = EasingMode.EaseInOut})
                        .AddEasingKeyFrame(Duration*0.4, 60, new CubicEase {EasingMode = EasingMode.EaseInOut})
                        .AddEasingKeyFrame(Duration*0.6, 80, new CubicEase {EasingMode = EasingMode.EaseInOut})
                        .AddEasingKeyFrame(Duration*0.8, 60, new CubicEase {EasingMode = EasingMode.EaseInOut})
                        .AddEasingKeyFrame(Duration, 70),

                    element.AnimateProperty(AnimationProperty.TranslateY)
                        .AddEasingKeyFrame(Duration*0.7, transform.TranslateY)
                        .AddEasingKeyFrame(Duration, transform.TranslateY + Distance, new CubicEase { EasingMode = EasingMode.EaseIn}),

                    element.AnimateProperty(AnimationProperty.Opacity)
                        .AddEasingKeyFrame(0.0, 1)
                        .AddEasingKeyFrame(Duration*0.9, 1)
                        .AddEasingKeyFrame(Duration, 0),
                };
            return new Timeline[]
            {
                element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
                    .AddDiscreteKeyFrame(0.0, new Point(1,0)),

                element.AnimateProperty(AnimationProperty.Rotation)
                    .AddEasingKeyFrame(0.0, 0, new CubicEase {EasingMode = EasingMode.EaseInOut})
                    .AddEasingKeyFrame(Duration*0.2, -80, new CubicEase {EasingMode = EasingMode.EaseInOut})
                    .AddEasingKeyFrame(Duration*0.4, -60, new CubicEase {EasingMode = EasingMode.EaseInOut})
                    .AddEasingKeyFrame(Duration*0.6, -80, new CubicEase {EasingMode = EasingMode.EaseInOut})
                    .AddEasingKeyFrame(Duration*0.8, -60, new CubicEase {EasingMode = EasingMode.EaseInOut})
                    .AddEasingKeyFrame(Duration,-70),

                element.AnimateProperty(AnimationProperty.TranslateY)
                    .AddEasingKeyFrame(Duration*0.7, transform.TranslateY)
                    .AddEasingKeyFrame(Duration, transform.TranslateY + Distance, new CubicEase { EasingMode = EasingMode.EaseIn}),

                element.AnimateProperty(AnimationProperty.Opacity)
                    .AddEasingKeyFrame(0.0, 1)
                    .AddEasingKeyFrame(Duration*0.9, 1)
                    .AddEasingKeyFrame(Duration, 0),
            };
        }
开发者ID:uwper,项目名称:AnimationManager,代码行数:50,代码来源:HingeAnimation.cs

示例7: CreateAnimation

 public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
 {
     return new Timeline[]
     {
         element.AnimateProperty(AnimationProperty.Opacity)
             .AddEasingKeyFrame(0.0, 0)
             .AddEasingKeyFrame(Duration/2, 1)
             .AddEasingKeyFrame(Duration, 1),
         element.AnimateProperty(AnimationProperty.ScaleX)
             .AddEasingKeyFrame(0.0, StartScale)
             .AddEasingKeyFrame(Duration, 1.0, new CubicEase()),
         element.AnimateProperty(AnimationProperty.ScaleY)
             .AddEasingKeyFrame(0.0, StartScale)
             .AddEasingKeyFrame(Duration, 1.0, new CubicEase()),
     };
 }
开发者ID:uwper,项目名称:AnimationManager,代码行数:16,代码来源:ScaleAnimations.cs

示例8: CreateAnimation

 public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
 {
     return new Timeline[]
     {
         element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
             .AddDiscreteKeyFrame(0.0, new Point(HorizontalCentre, 0.5)),
         element.AnimateProperty(AnimationProperty.ScaleX)
             .AddEasingKeyFrame(0.0, 1)
             .AddEasingKeyFrame(Duration, 0.95), //, new CubicEase { EasingMode = EasingMode.EaseIn });
         element.AnimateProperty(AnimationProperty.ScaleY)
             .AddEasingKeyFrame(0.0, 1)
             .AddEasingKeyFrame(Duration, 0.95), //, new CubicEase { EasingMode = EasingMode.EaseIn });
         element.AnimateProperty(AnimationProperty.Opacity)
             .AddEasingKeyFrame(0.0, 1)
             .AddEasingKeyFrame(Duration/4, 1)
             .AddEasingKeyFrame(Duration, 0.7),
     };
 }
开发者ID:uwper,项目名称:AnimationManager,代码行数:18,代码来源:FrameAnimations.cs

示例9: CreateAnimation

        public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
        {
            var transform = GetTransform(element);

            var list = new List<Timeline>();

            if (FromDirection != ZDirection.Steady)
            {
                list.Add(
                    element.AnimateProperty(AnimationProperty.ScaleX)
                        .AddEasingKeyFrame(0.0, (FromDirection == ZDirection.Away ? 0.3 : 2.0))
                        .AddEasingKeyFrame(Duration, 1, new BackEase {Amplitude = Amplitude}));
                list.Add(
                    element.AnimateProperty(AnimationProperty.ScaleY)
                        .AddEasingKeyFrame(0.0, (FromDirection == ZDirection.Away ? 0.3 : 2.0))
                        .AddEasingKeyFrame(Duration, 1, new BackEase {Amplitude = Amplitude}));
            };
            list.Add(
                element.AnimateProperty(AnimationProperty.Opacity)
                    .AddEasingKeyFrame(0.0, 0)
                    .AddEasingKeyFrame(Duration/4, 1));
            if (Math.Abs(DistanceX) > 0)
            {
                list.Add(
                    element.AnimateProperty(AnimationProperty.TranslateX)
                    .AddEasingKeyFrame(0.0, transform.TranslateX + DistanceX)
                    .AddEasingKeyFrame(Duration, transform.TranslateX, new BackEase {Amplitude = Amplitude}));
            }
            if (Math.Abs(DistanceY) > 0)
            {
                list.Add(
                    element.AnimateProperty(AnimationProperty.TranslateY)
                    .AddEasingKeyFrame(0.0, transform.TranslateY + DistanceY)
                    .AddEasingKeyFrame(Duration, transform.TranslateY, new BackEase {Amplitude = Amplitude}));
            }

            return list;
        }
开发者ID:uwper,项目名称:AnimationManager,代码行数:38,代码来源:BounceAnimations.cs

示例10: CreateAnimation

        public override IEnumerable<Timeline> CreateAnimation(FrameworkElement element)
        {
            double startRotation = 0.0;
            double endRotation;

            if (StartRotation.HasValue)
                startRotation = StartRotation.Value;
            else
            {
                var compositeTransform = element.RenderTransform as CompositeTransform;
                if (compositeTransform != null)
                    startRotation = compositeTransform.Rotation;
            }
            if (EndRotation.HasValue)
                endRotation = EndRotation.Value;
            else
                endRotation = startRotation + 360.0;

            return new Timeline[]
            {
                element.AnimatePointProperty(AnimationProperty.RenderTransformOrigin)
                    .AddDiscreteKeyFrame(0.0, new Point(0.5, 0.5)),

                element.AnimateProperty(AnimationProperty.Rotation)
                    .AddEasingKeyFrame(0.0, startRotation)
                    .AddEasingKeyFrame(Duration, endRotation, Easing)
                    .AddDiscreteKeyFrame(Duration, startRotation),
            };
        }
开发者ID:uwper,项目名称:AnimationManager,代码行数:29,代码来源:RotateAnimations.cs


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