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

C# IEasingFunction类代码示例

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

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



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

示例1: AnimateDoubleProperty

        /// <summary>
        /// Animates specified property of the object.
        /// </summary>
        /// <param name="target">The target object to animate.</param>
        /// <param name="propertyPath">Property path, e.g. Canvas.Top.</param>
        /// <param name="from">Animation's starting value.</param>
        /// <param name="to">Animation's ending value.</param>
        /// <param name="milliseconds">Duration of the animation in milliseconds.</param>
        /// <param name="easingFunction">Easing function applied to the animation.</param>
        /// <param name="completed">Event handler called when animation completed.</param>
        /// <returns>Returns started storyboard.</returns>
        public static Storyboard AnimateDoubleProperty(this DependencyObject target, string propertyPath, double? from, double? to, double milliseconds,
            IEasingFunction easingFunction = null, EventHandler completed = null)
        {
            Duration duration = new Duration(TimeSpan.FromMilliseconds(milliseconds));
            DoubleAnimation doubleAnimation = new DoubleAnimation()
            {
                From = from,
                To = to,
                Duration = duration,
                EasingFunction = easingFunction
            };

            Storyboard storyboard = new Storyboard();
            storyboard.Duration = duration;
            storyboard.Children.Add(doubleAnimation);

            Storyboard.SetTarget(doubleAnimation, target);
            Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath(propertyPath));

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

            storyboard.Begin();

            return storyboard;
        }
开发者ID:Zoomicon,项目名称:ZUI,代码行数:37,代码来源:AnimationExtensions.cs


示例2: EasingByteKeyFrame

 /// <summary>
 /// Creates a new EasingByteKeyFrame.
 /// </summary>
 public EasingByteKeyFrame(Byte value, KeyTime keyTime, IEasingFunction easingFunction)
     : this()
 {
     Value = value;
     KeyTime = keyTime;
     EasingFunction = easingFunction;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:10,代码来源:EasingKeyFrames.cs


示例3: GetAnimation

        public static Storyboard GetAnimation(AnimationDirection? animationDirection, bool isInAnimation, int animationTimeMS, IEasingFunction easingFunction = null)
        {
            var xAxis = "RenderTransform.(TranslateTransform.X)";
            var yAxis = "RenderTransform.(TranslateTransform.Y)";
            var easing = easingFunction != null ? easingFunction : new QuadraticEase();

            var opac = GetOpac(isInAnimation, animationTimeMS);

            var story = new Storyboard();
            (story as IAddChild).AddChild(opac);

            DoubleAnimation anim = null;

            if (animationDirection != null)
            {
                if (isInAnimation)
                {
                    anim = new DoubleAnimation(animationDirection == AnimationDirection.Left || animationDirection == AnimationDirection.Top ? -30 : 30, 0, new Duration(new TimeSpan(0, 0, 0, 0, animationTimeMS))) { EasingFunction = easing };
                }
                else
                {
                    anim = new DoubleAnimation(0, animationDirection == AnimationDirection.Left || animationDirection == AnimationDirection.Top ? -30 : 30, new Duration(new TimeSpan(0, 0, 0, 0, animationTimeMS))) { EasingFunction = easing };
                }

                if (anim != null)
                {
                    anim.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath(animationDirection == AnimationDirection.Left || animationDirection == AnimationDirection.Right ? xAxis : yAxis));
                    (story as IAddChild).AddChild(anim);
                }
            }

            return story;
        }
开发者ID:KayRaettig,项目名称:ModernUIAnimationTest,代码行数:33,代码来源:AnimationProducer.cs


示例4: EasingThicknessKeyFrame

 /// <summary>
 /// Creates a new EasingThicknessKeyFrame.
 /// </summary>
 public EasingThicknessKeyFrame(Thickness value, KeyTime keyTime, IEasingFunction easingFunction)
     : this()
 {
     Value = value;
     KeyTime = keyTime;
     EasingFunction = easingFunction;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:10,代码来源:EasingKeyFrames.cs


示例5: Animate

        public static void Animate(this DependencyObject target, double from, double to, object propertyPath, int duration, int startTime, IEasingFunction easing = null, Action completed = null)
        {
            if (easing == null)
                easing = new SineEase();

            var db = new DoubleAnimation();
            db.To = to;
            db.From = from;
            db.EasingFunction = easing;
            db.Duration = TimeSpan.FromMilliseconds(duration);

            Storyboard.SetTarget(db, target);
            Storyboard.SetTargetProperty(db, new PropertyPath(propertyPath));

            var sb = new Storyboard();
            sb.BeginTime = TimeSpan.FromMilliseconds(startTime);

            if (completed != null)
            {
                sb.Completed += (s, e) => completed();
            }

            sb.Children.Add(db);
            sb.Begin();
        }
开发者ID:kiendev,项目名称:FarjiChat,代码行数:25,代码来源:Extensions.cs


示例6: CreateAnim

        public static DoubleAnimationUsingKeyFrames CreateAnim(this Storyboard sb, DependencyObject target,
            string propertyPath, IEasingFunction easing, double value, TimeSpan keyTime)
        {
            var doubleAnim = (from anim in sb.Children.OfType<DoubleAnimationUsingKeyFrames>()
                     where GetSBExtTarget(anim) == target
                     let prop = Storyboard.GetTargetProperty(anim)
                     where prop.Path == propertyPath
                     select anim).FirstOrDefault();

            if (doubleAnim == null)
            {
                doubleAnim = new DoubleAnimationUsingKeyFrames();
                SetSBExtTarget(doubleAnim, target);
                Storyboard.SetTarget(doubleAnim, target);
                Storyboard.SetTargetProperty(doubleAnim, new System.Windows.PropertyPath(propertyPath));
                sb.Children.Add(doubleAnim);
            }

            EasingDoubleKeyFrame kf = new EasingDoubleKeyFrame();
            kf.EasingFunction = easing;
            kf.KeyTime = keyTime;
            kf.Value = value;
            doubleAnim.KeyFrames.Add(kf);

            return doubleAnim;
        }
开发者ID:Titaye,项目名称:SLExtensions,代码行数:26,代码来源:StoryboardExtensions.cs


示例7: AddDouble

        /// 
        /// <summary>
        /// Helper to create double animation</summary>
        /// 
        public static Storyboard AddDouble(
            this Storyboard                             sb,
            int                                         durationMs,
            DependencyObject                            element,
            PropertyPath                                path,
            double                                      from,
            double                                      to,
            IEasingFunction                             easing = null
        )
        {
            DoubleAnimation                             da;

            da = new DoubleAnimation();
            da.Duration = new Duration(TimeSpan.FromMilliseconds(durationMs));

            da.From = from;
            da.To =  to;

            if (easing != null)
            {
                da.EasingFunction = easing;
            }

            Storyboard.SetTarget(da, element);
            Storyboard.SetTargetProperty(da, path);

            sb.Children.Add(da);
            return sb;
        }
开发者ID:TrakHound,项目名称:TrakHound-Community,代码行数:33,代码来源:Utilities.cs


示例8: AccordionPanel

        static AccordionPanel()
        {
            var animationDuration   = new Duration (TimeSpan.FromMilliseconds(400));
            IEasingFunction animationEase       = new ExponentialEase
                                    {
                                        EasingMode = EasingMode.EaseInOut,
                                    };

            s_animationDuration     = animationDuration;
            s_animationEase         = animationEase;

            Initialize (ref animationDuration, ref animationEase);

            s_animationDuration     = animationDuration;
            s_animationEase         = animationEase;

            s_animationClock       = new DoubleAnimation(
                0                       ,
                1                       ,
                s_animationDuration     ,
                FillBehavior.Stop
                )
                .FreezeObject ()
                ;
        }
开发者ID:mrange,项目名称:T4Include,代码行数:25,代码来源:AccordionPanel.cs


示例9: BeginAnimation

 public static void BeginAnimation(ChartArea seriesHost, string propertyName, object currentValue, object targetValue, Action<object, object> propertyUpdateAction, Dictionary<string, StoryboardInfo> storyboards, TimeSpan timeSpan, IEasingFunction easingFunction)
 {
     if (timeSpan == TimeSpan.Zero)
         propertyUpdateAction(currentValue, targetValue);
     else
         DependencyPropertyAnimationHelper.CreateAnimation(seriesHost, propertyName, currentValue, targetValue, propertyUpdateAction, storyboards, timeSpan, easingFunction).Begin();
 }
开发者ID:sulerzh,项目名称:chart,代码行数:7,代码来源:DependencyPropertyAnimationHelper.cs


示例10: Animate

        public static void Animate(this DependencyObject target, double? from, double? to, object propertyPath,
                                   int duration, int startTime,
                                   IEasingFunction easing = null, Action completed = null)
        
        {
            if (easing == null)
                easing = new SineEase();

            var animation = new DoubleAnimation
            {
                To = to,
                From = @from,
                EasingFunction = easing,
                Duration = TimeSpan.FromMilliseconds(duration)
            };
            Storyboard.SetTarget(animation, target);
            Storyboard.SetTargetProperty(animation, new PropertyPath(propertyPath));

            var storyBoard = new Storyboard {BeginTime = TimeSpan.FromMilliseconds(startTime)};

            if (completed != null)
                storyBoard.Completed += (sender, args) => completed();

            storyBoard.Children.Add(animation);
            storyBoard.Begin();
        }
开发者ID:Bunk,项目名称:trellow,代码行数:26,代码来源:FrameworkElementExtensions.cs


示例11: AnimateTranslateTransform

        /// <summary>
        /// Animates the translate transform object, responsible for displacement of the target.
        /// </summary>
        /// <param name="target">The target object.</param>
        /// <param name="storyboard">The storyboard.</param>
        /// <param name="to">Animation's ending value.</param>
        /// <param name="seconds">Duration of the animation in seconds.</param>
        /// <param name="easingFunction">Easing function applied to the animation.</param>
        public static void AnimateTranslateTransform(this DependencyObject target, Storyboard storyboard, Point to,
            double seconds, IEasingFunction easingFunction = null)
        {
            Duration duration = new Duration(TimeSpan.FromSeconds(seconds));

            DoubleAnimation doubleAnimationX = new DoubleAnimation()
            {
                To = to.X,
                Duration = duration,
                EasingFunction = easingFunction
            };

            DoubleAnimation doubleAnimationY = new DoubleAnimation()
            {
                To = to.Y,
                Duration = duration,
                EasingFunction = easingFunction
            };

            storyboard.Stop();
            storyboard.Children.Clear();
            storyboard.Duration = duration;
            storyboard.Children.Add(doubleAnimationX);
            storyboard.Children.Add(doubleAnimationY);

            Storyboard.SetTarget(doubleAnimationX, target);
            Storyboard.SetTarget(doubleAnimationY, target);
            Storyboard.SetTargetProperty(doubleAnimationX, (target as UIElement).GetPropertyPathForTranslateTransformX());
            Storyboard.SetTargetProperty(doubleAnimationY, (target as UIElement).GetPropertyPathForTranslateTransformY());

            storyboard.Begin();
        }
开发者ID:Zoomicon,项目名称:ZUI,代码行数:40,代码来源:AnimationExtensions.cs


示例12: CreateAnimation

 public static Storyboard CreateAnimation(this DependencyObject target, Dictionary<string, StoryboardInfo> storyboards, DependencyProperty animatingDependencyProperty, string propertyPath, string propertyKey, object initialValue, object targetValue, TimeSpan timeSpan, IEasingFunction easingFunction, Action releaseAction)
 {
     StoryboardInfo storyboardInfo;
     storyboards.TryGetValue(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey), out storyboardInfo);
     if (storyboardInfo != null)
     {
         DependencyObject storyboardTarget = storyboardInfo.StoryboardTarget;
         storyboardInfo.Storyboard.Stop();
         storyboards.Remove(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey));
         if (storyboardInfo.ReleaseAction != null)
         {
             storyboardInfo.ReleaseAction();
             storyboardInfo.ReleaseAction = (Action)null;
         }
     }
     storyboardInfo = new StoryboardInfo();
     storyboardInfo.Storyboard = DependencyPropertyAnimationHelper.CreateStoryboard(target, animatingDependencyProperty, propertyPath, propertyKey, ref targetValue, timeSpan, easingFunction);
     storyboardInfo.ReleaseAction = releaseAction;
     storyboardInfo.StoryboardTarget = target;
     storyboardInfo.AnimateFrom = initialValue;
     storyboardInfo.Storyboard.Completed += (EventHandler)((source, args) =>
        {
        storyboards.Remove(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey));
        if (storyboardInfo.ReleaseAction == null)
            return;
        storyboardInfo.ReleaseAction();
        storyboardInfo.ReleaseAction = (Action)null;
        });
     storyboards.Add(DependencyPropertyAnimationHelper.GetStoryboardKey(propertyKey), storyboardInfo);
     return storyboardInfo.Storyboard;
 }
开发者ID:sulerzh,项目名称:chart,代码行数:31,代码来源:DependencyPropertyAnimationHelper.cs


示例13: AnimationInfo

 public AnimationInfo(DependencyObject target, PropertyPath propertyPath, double startValue, double endValue, IEasingFunction easingFunction = null)
 {
     Target = target;
       PropertyPath = propertyPath;
       StartValue = startValue;
       EndValue = endValue;
       EasingFunction = easingFunction;
 }
开发者ID:valentinkip,项目名称:Test,代码行数:8,代码来源:UIManager.cs


示例14: RangeAnimation

 public RangeAnimation(Range from, Range to, Duration duration, FillBehavior fillBehavior = FillBehavior.Stop, IEasingFunction easingFunction = null)
 {
     From = from;
     To = to;
     Duration = duration;
     FillBehavior = fillBehavior;
     EasingFunction = easingFunction;
 }
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:8,代码来源:RangeAnimation.cs


示例15: CreateDoubleAnimation

        public static DoubleAnimation CreateDoubleAnimation(string targetName, DependencyProperty targetProperty, double toValue, double fromValue = 0.0, TimeSpan? beginTimeSpan = null, TimeSpan? durationSpan = null, IEasingFunction easingFuction = null)
        {
            var animation = CreateDoubleAnimation(toValue, fromValue, beginTimeSpan, durationSpan, easingFuction);
            Storyboard.SetTargetName(animation, targetName);
            Storyboard.SetTargetProperty(animation, new PropertyPath(targetProperty));

            return animation;
        }
开发者ID:minasabb,项目名称:SprintDashboard,代码行数:8,代码来源:AnimationFactory.cs


示例16: CreateAnimation

 public static DoubleAnimation CreateAnimation(double from, double to, double beginTime, double time, IEasingFunction ease = null, EventHandler completed = null)
 {
     DoubleAnimation animation = new DoubleAnimation(from, to, new Duration(TimeSpan.FromSeconds(time)));
     animation.BeginTime = TimeSpan.FromSeconds(beginTime);
     if (ease != null) animation.EasingFunction = ease;
     if (completed != null) animation.Completed += completed;
     animation.Freeze();
     return animation;
 }
开发者ID:CodefoundryDE,项目名称:ViennaTrafficMonitor,代码行数:9,代码来源:AnimateLib.cs


示例17: GetGenericAnimation

 //public static DoubleAnimation TranslateYOnNavigateIn()
 //{
 //    return TranslateY(250, 350, 0, new ExponentialEase() { EasingMode = EasingMode.EaseOut, Exponent = 4 });
 //}
 //public static DoubleAnimation ChangeOpacityOnNavigateIn()
 //{
 //    return ChangeOpacity(0, 250, 1, new ExponentialEase() { EasingMode = EasingMode.EaseOut });
 //}
 private static DoubleAnimation GetGenericAnimation(double from, double to, int millis, IEasingFunction easingFunction)
 {
     DoubleAnimation d = new DoubleAnimation();
     d.EasingFunction = easingFunction;
     d.Duration = TimeSpan.FromMilliseconds(millis);
     d.From = from;
     d.To = to;
     return d;
 }
开发者ID:hmehart,项目名称:Notepad,代码行数:17,代码来源:AnimationUtils.cs


示例18: MarginTween

        public MarginTween(FrameworkElement target, Thickness startValue, Thickness endValue, Duration duration, IEasingFunction easingFunction)
            : this()
        {
            StartMargin = startValue;
            EndMargin = endValue;

            Target = target;
            Duration = duration;
            EasingFunction = easingFunction;
        }
开发者ID:jsmithorg,项目名称:Animation,代码行数:10,代码来源:MarginTween.cs


示例19: CreateDoubleAnimation

 private static DoubleAnimation CreateDoubleAnimation(double fromValue, double toValue, double seconds, IEasingFunction easing)
 {
     var animation = new DoubleAnimation
                             {
                                 From = fromValue,
                                 To = toValue,
                                 Duration = new Duration(TimeSpan.FromSeconds(seconds)),
                             };
     return animation;
 }
开发者ID:philcockfield,项目名称:Open.TestHarness.SL,代码行数:10,代码来源:AnimationUtil.wpf.cs


示例20: GoTo

/*        public void GoTo(double targetOpacity, Duration duration, IEasingFunction easingFunction)
        {
            GoTo(targetOpacity, duration, easingFunction, null);
        }*/
        public void GoTo(double targetOpacity, Duration duration, IEasingFunction easingFunction, Action completionAction)
        {
            _daRunning.To = targetOpacity;
            _daRunning.Duration = duration;
            _daRunning.EasingFunction = easingFunction;
            _sbRunning.Begin();
            _suppressChangeNotification = true;
            _sbRunning.SeekAlignedToLastTick(TimeSpan.Zero);
            _oneTimeAction = completionAction;
        }
开发者ID:TediWang,项目名称:4thandmayor-ancient,代码行数:14,代码来源:OpacityAnimator.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IEcoregion类代码示例发布时间:2022-05-24
下一篇:
C# IE类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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