• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Animation.EasingFunctionBase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Windows.UI.Xaml.Media.Animation.EasingFunctionBase的典型用法代码示例。如果您正苦于以下问题:C# EasingFunctionBase类的具体用法?C# EasingFunctionBase怎么用?C# EasingFunctionBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EasingFunctionBase类属于Windows.UI.Xaml.Media.Animation命名空间,在下文中一共展示了EasingFunctionBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FadeInAsync

 public static async Task FadeInAsync(this UIElement element, double duration = 250, EasingFunctionBase easingFunction = null)
 {
     if (element.Opacity < 1.0)
     {
         await AnimateDoublePropertyAsync(element, "Opacity", element.Opacity, 1.0, duration, easingFunction);
     }
 }
开发者ID:chengchencc,项目名称:CC.GeneralCode,代码行数:7,代码来源:AnimationExtensions.cs


示例2: Draw

        public void Draw(EasingFunctionBase easingFunction)
        {
            canvas1.Children.Clear();


            var pathSegments = new PathSegmentCollection();

            for (double i = 0; i < 1; i += SamplingInterval)
            {
                double x = i * canvas1.Width;
                double y = easingFunction.Ease(i) * canvas1.Height;

                var segment = new LineSegment();
                segment.Point = new Point(x, y);

                pathSegments.Add(segment);

            }
            var p = new Path();
            p.Stroke = new SolidColorBrush(Colors.Black);
            p.StrokeThickness = 3;
            var figures = new PathFigureCollection();
            figures.Add(new PathFigure() { Segments = pathSegments });
            p.Data = new PathGeometry() { Figures = figures };
            canvas1.Children.Add(p);
        }
开发者ID:ProfessionalCSharp,项目名称:ProfessionalCSharp6,代码行数:26,代码来源:EasingChartControl.xaml.cs


示例3: AnimateHeightAsync

 public static async Task AnimateHeightAsync(this FrameworkElement element, double height, double duration = 250, EasingFunctionBase easingFunction = null)
 {
     if (element.Height != height)
     {
         await AnimateDoublePropertyAsync(element, "Height", element.ActualHeight, height, duration, easingFunction);
     }
 }
开发者ID:chengchencc,项目名称:CC.GeneralCode,代码行数:7,代码来源:AnimationExtensions.cs


示例4: AnimateWidthAsync

 public static async Task AnimateWidthAsync(this FrameworkElement element, double width, double duration = 250, EasingFunctionBase easingFunction = null)
 {
     if (element.ActualWidth != width)
     {
         await AnimateDoublePropertyAsync(element, "Width", element.ActualWidth, width, duration, easingFunction);
     }
 }
开发者ID:chengchencc,项目名称:CC.GeneralCode,代码行数:7,代码来源:AnimationExtensions.cs


示例5: BeginAnimation

        /// <summary>
        /// Starts animating a dependency property of a framework element to a 
        /// target value.
        /// </summary>
        /// <param name="target">The element to animate.</param>
        /// <param name="animatingDependencyProperty">The dependency property to
        /// animate.</param>
        /// <param name="propertyPath">The path of the dependency property to 
        /// animate.</param>
        /// <param name="targetValue">The value to animate the dependency
        /// property to.</param>
        /// <param name="timeSpan">The duration of the animation.</param>
        /// <param name="easingFunction">The easing function to uses to
        /// transition the data points.</param>
        public static void BeginAnimation(
            this FrameworkElement target,
            DependencyProperty animatingDependencyProperty,
            string propertyPath,
            object targetValue,
            TimeSpan timeSpan,
            EasingFunctionBase easingFunction)
        {
            Storyboard storyBoard = target.Resources[GetStoryboardKey(propertyPath)] as Storyboard;

            if (storyBoard != null)
            {
                // Save current value
                object currentValue = target.GetValue(animatingDependencyProperty);
                storyBoard.Stop();
                // RestoreAsync that value so it doesn't snap back to its starting value
                target.SetValue(animatingDependencyProperty, currentValue);
                target.Resources.Remove(GetStoryboardKey(propertyPath));
            }

            storyBoard = CreateStoryboard(target, animatingDependencyProperty, propertyPath, ref targetValue, timeSpan, easingFunction);

            storyBoard.Completed += 
                (source, args) =>
                    {
                        storyBoard.Stop();
                        target.SetValue(animatingDependencyProperty, targetValue);
                        target.Resources.Remove(GetStoryboardKey(propertyPath));
                    };

            target.Resources.Add(GetStoryboardKey(propertyPath), storyBoard);
            storyBoard.Begin();
        }
开发者ID:siatwangmin,项目名称:WinRTXamlToolkit,代码行数:47,代码来源:DependencyPropertyAnimationHelper.cs


示例6: AnimateScaleXAsync

 public static async Task AnimateScaleXAsync(this FrameworkElement element, double x, double duration = 150, EasingFunctionBase easingFunction = null)
 {
     if (element.GetScaleX() != x)
     {
         await AnimateDoublePropertyAsync(element.GetCompositeTransform(), "ScaleX", element.GetScaleX(), x, duration, easingFunction);
     }
 }
开发者ID:ridomin,项目名称:waslibs,代码行数:7,代码来源:AnimationExtensions.cs


示例7: StartAnimation

        private void StartAnimation(EasingFunctionBase easingFunction)
        {
            // show the chart
            chartControl.Draw(easingFunction);

            // animation
#if WPF
            NameScope.SetNameScope(translate1, new NameScope());
#endif

            var storyboard = new Storyboard();
            var ellipseMove = new DoubleAnimation();
            ellipseMove.EasingFunction = easingFunction;
            ellipseMove.Duration = new Duration(TimeSpan.FromSeconds(AnimationTimeSeconds));
            ellipseMove.From = 0;
            ellipseMove.To = 460;
#if WPF
            Storyboard.SetTargetName(ellipseMove, nameof(translate1));
            Storyboard.SetTargetProperty(ellipseMove, new PropertyPath(TranslateTransform.XProperty));
#else
            Storyboard.SetTarget(ellipseMove, translate1);
            Storyboard.SetTargetProperty(ellipseMove, "X");
#endif

            ellipseMove.BeginTime = TimeSpan.FromSeconds(0.5); // start animation in 0.5 seconds
            ellipseMove.FillBehavior = FillBehavior.HoldEnd; // keep position after animation

            storyboard.Children.Add(ellipseMove);
#if WPF
            storyboard.Begin(this);
#else
            storyboard.Begin();
#endif
        }
开发者ID:ProfessionalCSharp,项目名称:ProfessionalCSharp6,代码行数:34,代码来源:EasingFunctions.xaml.cs


示例8: AnimateYAsync

 public static async Task AnimateYAsync(this FrameworkElement element, double y, double duration = 250, EasingFunctionBase easingFunction = null)
 {
     if (element.GetTranslateY() != y)
     {
         await AnimateDoublePropertyAsync(element.GetCompositeTransform(), "TranslateY", element.GetTranslateY(), y, duration, easingFunction);
     }
 }
开发者ID:chengchencc,项目名称:CC.GeneralCode,代码行数:7,代码来源:AnimationExtensions.cs


示例9: AnimateHeight

 public static Storyboard AnimateHeight(this FrameworkElement element, double height, double duration = 250, EasingFunctionBase easingFunction = null)
 {
     if (element.Height != height)
     {
         return AnimateDoubleProperty(element, "Height", element.ActualHeight, height, duration, easingFunction);
     }
     return null;
 }
开发者ID:chengchencc,项目名称:CC.GeneralCode,代码行数:8,代码来源:AnimationExtensions.cs


示例10: AnimateWidth

 public static Storyboard AnimateWidth(this FrameworkElement element, double width, double duration = 250, EasingFunctionBase easingFunction = null)
 {
     if (element.ActualWidth != width)
     {
         return AnimateDoubleProperty(element, "Width", element.ActualWidth, width, duration, easingFunction);
     }
     return null;
 }
开发者ID:chengchencc,项目名称:CC.GeneralCode,代码行数:8,代码来源:AnimationExtensions.cs


示例11: AnimateScaleX

 public static Storyboard AnimateScaleX(this FrameworkElement element, double x, double duration = 150, EasingFunctionBase easingFunction = null)
 {
     if (element.GetScaleX() != x)
     {
         return AnimateDoubleProperty(element.GetCompositeTransform(), "ScaleX", element.GetScaleX(), x, duration, easingFunction);
     }
     return null;
 }
开发者ID:ridomin,项目名称:waslibs,代码行数:8,代码来源:AnimationExtensions.cs


示例12: AnimateY

 public static Storyboard AnimateY(this FrameworkElement element, double y, double duration = 250, EasingFunctionBase easingFunction = null)
 {
     if (element.GetTranslateY() != y)
     {
         return AnimateDoubleProperty(element.GetCompositeTransform(), "TranslateY", element.GetTranslateY(), y, duration, easingFunction);
     }
     return null;
 }
开发者ID:chengchencc,项目名称:CC.GeneralCode,代码行数:8,代码来源:AnimationExtensions.cs


示例13: FadeIn

 public static Storyboard FadeIn(this UIElement element, double duration = 250, EasingFunctionBase easingFunction = null)
 {
     if (element.Opacity < 1.0)
     {
         return AnimateDoubleProperty(element, "Opacity", element.Opacity, 1.0, duration, easingFunction);
     }
     return null;
 }
开发者ID:chengchencc,项目名称:CC.GeneralCode,代码行数:8,代码来源:AnimationExtensions.cs


示例14: CreatAnimation

 /// <summary>
 /// 创建动画
 /// </summary> 
 public static DoubleAnimation CreatAnimation(DependencyObject obj, string path, int duration, EasingFunctionBase easing = null)
 {
     DoubleAnimation da = new DoubleAnimation();
     da.EasingFunction = easing;
     da.Duration = TimeSpan.FromMilliseconds(duration);
     Storyboard.SetTarget(da, obj);
     Storyboard.SetTargetProperty(da, path);
     return da;
 }
开发者ID:HppZ,项目名称:UniversalTest,代码行数:12,代码来源:StoryboardHelper.cs


示例15: CreateDoubleAnimation

 public static DoubleAnimation CreateDoubleAnimation(double? from, double? to, Duration duration, string targetProperty, DependencyObject target, EasingFunctionBase easing = null)
 {
     var db = new DoubleAnimation();
     db.To = to;
     db.From = from;
     db.EasingFunction = easing;
     db.Duration = duration;
     Storyboard.SetTarget(db, target);
     Storyboard.SetTargetProperty(db, targetProperty);
     return db;
 }
开发者ID:king89,项目名称:MangaViewer,代码行数:11,代码来源:AnimationHelp.cs


示例16: AddAnimation

        public static void AddAnimation(this Storyboard storyboard, DependencyObject element,
                                        int duration, double toValue, String propertyPath,
                                        EasingFunctionBase easingFunction = null)
        {
            DoubleAnimation timeline = new DoubleAnimation();
            timeline.To = toValue;
            timeline.Duration = TimeSpan.FromMilliseconds(duration);
            if (easingFunction != null)
                timeline.EasingFunction = easingFunction;

            storyboard.Children.Add(timeline);

            Storyboard.SetTarget(timeline, element);
            Storyboard.SetTargetProperty(timeline, propertyPath);
        }
开发者ID:KarthikMAM,项目名称:Paradigm,代码行数:15,代码来源:StoryboardExtensions.cs


示例17: FadeInCustom

        /// <summary>
        /// Fades the element in using a custom DoubleAnimation of the Opacity property.
        /// </summary>
        /// <param name="dob"></param>
        /// <param name="duration"></param>
        /// <param name="easingFunction"> </param>
        /// <returns></returns>
        public static async Task FadeInCustom(this DependencyObject dob, TimeSpan? duration = null, EasingFunctionBase easingFunction = null)
        {
            var fadeInStoryboard = new Storyboard();
            var fadeInAnimation = new DoubleAnimation();

            if (duration == null)
                duration = TimeSpan.FromSeconds(0.4);

            fadeInAnimation.Duration = duration.Value;
            fadeInAnimation.To = 1.0;
            fadeInAnimation.EasingFunction = easingFunction;

            Storyboard.SetTarget(fadeInAnimation, dob);
            Storyboard.SetTargetProperty(fadeInAnimation, "Opacity");
            fadeInStoryboard.Children.Add(fadeInAnimation);
            await fadeInStoryboard.BeginAsync();
        }
开发者ID:chao-zhou,项目名称:PomodoroTimer,代码行数:24,代码来源:DependencyObjectAnimationExtensions.cs


示例18: Animate

        public static void Animate(this DependencyObject element, string propertyPath, 
                                int duration, double toValue,EasingFunctionBase easingFunction = null, EventHandler<Object> completed = null)
        {
            DoubleAnimation timeline = new DoubleAnimation();
            timeline.To = toValue;
            timeline.Duration = TimeSpan.FromMilliseconds(duration);
            if (easingFunction != null)
                timeline.EasingFunction = easingFunction;

            Storyboard sb = new Storyboard();
            if (completed != null)
                sb.Completed += completed;

            sb.Children.Add(timeline);
            Storyboard.SetTarget(sb, element);
            Storyboard.SetTargetProperty(sb, propertyPath);
            sb.Begin();
        }
开发者ID:KarthikMAM,项目名称:Paradigm,代码行数:18,代码来源:StoryboardExtensions.cs


示例19: To

        public static void To(AnimatableUserControl target, string property, double to, int duration,
            EasingFunctionBase easing = null, EventHandler<object> callback = null)
        {
            var transform = (CompositeTransform) target.RenderTransform;
            double from = 0.0;
            switch (property)
            {
                case "X":
                    from = transform.TranslateX;
                    break;
                case "Y":
                    from = transform.TranslateY;
                    break;
                case "ScaleX":
                    from = transform.ScaleX;
                    break;
                case "ScaleY":
                    from = transform.ScaleY;
                    break;
                case "Alpha":
                    from = target.Opacity;
                    break;
                default:
                    throw new Exception("Unsupported proptery");

            }

            easing = easing ?? new QuadraticEase();
            var storyboard = new Storyboard();

            if (callback != null)
                storyboard.Completed += callback;

            var anim = new DoubleAnimation();
            anim.EnableDependentAnimation = true;
            anim.Duration = TimeSpan.FromMilliseconds(duration);
            anim.EasingFunction = easing;
            anim.From = from;
            anim.To = to;
            storyboard.Children.Add(anim);
            Storyboard.SetTargetProperty(anim, property);
            Storyboard.SetTarget(anim, target);
            storyboard.Begin();
        }
开发者ID:philllies,项目名称:finalproject,代码行数:44,代码来源:Anim.cs


示例20: AnimateY

        public static void AnimateY(UIElement pin, double fromY, double toY, int duration, EasingFunctionBase easingFunction)
        {
            pin.RenderTransform = new TranslateTransform();

            var sb = new Storyboard();
            var animation = new DoubleAnimation()
            {
                From = fromY,
                To = toY,
                Duration = new TimeSpan(0, 0, 0, 0, duration),
                EasingFunction = easingFunction
            };

            Storyboard.SetTargetProperty(animation, "(UIElement.RenderTransform).(TranslateTransform.Y)");
            Storyboard.SetTarget(animation, pin);

            sb.Children.Add(animation);
            sb.Begin();
        }
开发者ID:andrmcg,项目名称:Stadium-Finder,代码行数:19,代码来源:PushpinAnimations.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Animation.Storyboard类代码示例发布时间:2022-05-26
下一篇:
C# Animation.DoubleAnimation类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap