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


C# IEasingFunction类代码示例

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


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


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