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


C# Animation.EasingFunctionBase类代码示例

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


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


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