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


C# DoubleAnimation.CreateClock方法代码示例

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


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

示例1: HideWithAnimation

        public static void HideWithAnimation(this Window window)
        {
            if (hideAnimationInProgress) return;

            try
            {
                hideAnimationInProgress = true;

                var hideAnimation = new DoubleAnimation
                {
                    Duration = new Duration(TimeSpan.FromSeconds(0.2)),
                    FillBehavior = FillBehavior.Stop,
                    EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseIn }
                };
                var taskbarPosition = TaskbarService.GetWinTaskbarState().TaskbarPosition;
                switch (taskbarPosition)
                {
                    case TaskbarPosition.Left:
                    case TaskbarPosition.Right:
                        hideAnimation.From = window.Left;
                        break;
                    default:
                        hideAnimation.From = window.Top;
                        break;
                }
                hideAnimation.To = (taskbarPosition == TaskbarPosition.Top || taskbarPosition == TaskbarPosition.Left) ? hideAnimation.From - 10 : hideAnimation.From + 10;
                hideAnimation.Completed += (s, e) =>
                {
                    window.Visibility = Visibility.Hidden;
                    hideAnimationInProgress = false;
                };

                switch (taskbarPosition)
                {
                    case TaskbarPosition.Left:
                    case TaskbarPosition.Right:
                        window.ApplyAnimationClock(Window.LeftProperty, hideAnimation.CreateClock());
                        break;
                    default:
                        window.ApplyAnimationClock(Window.TopProperty, hideAnimation.CreateClock());
                        break;
                }
            }
            catch
            {
                hideAnimationInProgress = false;
            }
        }
开发者ID:File-New-Project,项目名称:EarTrumpet,代码行数:48,代码来源:WindowExtensions.cs

示例2: ApplyAnimationClockTest

        private void ApplyAnimationClockTest(DoubleAnimation animation)
        {
            FrameworkElement element = new FrameworkElement();

            TestRootClock rootClock = new TestRootClock();
            rootClock.Tick(TimeSpan.FromSeconds(0));

            AnimationTimelineClock clock = (AnimationTimelineClock)animation.CreateClock();
            clock.Begin(rootClock);

            element.Width = 10;
            Assert.AreEqual(10, element.Width);

            element.ApplyAnimationClock(FrameworkElement.WidthProperty, clock);
            Assert.AreEqual(10, element.Width);

            rootClock.Tick(TimeSpan.FromSeconds(0.5));
            Assert.AreEqual(15, element.Width);

            rootClock.Tick(TimeSpan.FromSeconds(1));
            Assert.AreEqual(20, element.Width);

            clock.Stop();

            element.Width = 30;
            Assert.AreEqual(30, element.Width);
        }
开发者ID:highzion,项目名称:Granular,代码行数:27,代码来源:AnimationExpressionTest.cs

示例3: Init

        public void Init(MyModel mm)
        {
            this.mm = mm;

            Transform3DGroup t3dg = (Transform3DGroup)this.mm.m3dg.Transform;
            RotateTransform3D rtx = (RotateTransform3D)t3dg.Children[2];
            AxisAngleRotation3D aar3dx = (AxisAngleRotation3D)rtx.Rotation;
            RotateTransform3D rty = (RotateTransform3D)t3dg.Children[3];
            AxisAngleRotation3D aar3dy = (AxisAngleRotation3D)rty.Rotation;
            RotateTransform3D rtz = (RotateTransform3D)t3dg.Children[4];
            AxisAngleRotation3D aar3dz = (AxisAngleRotation3D)rtz.Rotation;

            DoubleAnimation dax = new DoubleAnimation(360, new Duration(new TimeSpan(0, 0, 10)));
            dax.RepeatBehavior = RepeatBehavior.Forever;
            //aar3dx.BeginAnimation(AxisAngleRotation3D.AngleProperty, dax);
            clockx = dax.CreateClock();

            DoubleAnimation day = new DoubleAnimation(360, new Duration(new TimeSpan(0, 0, 5)));
            day.RepeatBehavior = RepeatBehavior.Forever;
            clocky = day.CreateClock();

            DoubleAnimation daz = new DoubleAnimation(360, new Duration(new TimeSpan(0, 0, 5)));
            daz.RepeatBehavior = RepeatBehavior.Forever;
            clockz = daz.CreateClock();

            aar3dx.ApplyAnimationClock(AxisAngleRotation3D.AngleProperty, clockx);
            aar3dy.ApplyAnimationClock(AxisAngleRotation3D.AngleProperty, clocky);
            aar3dz.ApplyAnimationClock(AxisAngleRotation3D.AngleProperty, clockx);
            clockx.Controller.Begin();
            clocky.Controller.Begin();
            clockz.Controller.Begin();
        }
开发者ID:pyephyomaung,项目名称:som-ar,代码行数:32,代码来源:StarAnimated.cs

示例4: FlashWheel

        /// <summary>
        /// Flashes the control's wheel display.
        /// </summary>
        public void FlashWheel()
        {
            DoubleAnimation opacityAnimation = new DoubleAnimation(
                0.5, 0, new Duration(TimeSpan.FromSeconds(1)));

            AnimationClock opacityClock = opacityAnimation.CreateClock();

            this.mouseFill.ApplyAnimationClock(Path.OpacityProperty, opacityClock);
        }
开发者ID:alkampfergit,项目名称:BaktunShell,代码行数:12,代码来源:ActionIndicator.xaml.cs

示例5: AnimateIn

        void AnimateIn(object sender, EventArgs args) {
            var animation = new DoubleAnimation {
                From = -Height,
                To = 0,
                Duration = AnimationDuration,
                EasingFunction = AnimationEase,
            };

            animation.Completed += BeginTimer;

            RenderTransform.ApplyAnimationClock(TranslateTransform.YProperty,
                animation.CreateClock());
        }
开发者ID:DebugOfTheRoad,项目名称:BigData,代码行数:13,代码来源:FlashLabel.cs

示例6: AnimateOut

        void AnimateOut(object sender, EventArgs args) {
            var animation = new DoubleAnimation {
                From = 0,
                To = -Height,
                Duration = AnimationDuration,
                EasingFunction = AnimationEase,
            };

            animation.Completed += delegate {
                RaiseEvent(new RoutedEventArgs(DoneEvent));
            };

            RenderTransform.ApplyAnimationClock(
                TranslateTransform.YProperty,
                animation.CreateClock());
        }
开发者ID:DebugOfTheRoad,项目名称:BigData,代码行数:16,代码来源:FlashLabel.cs

示例7: ScaleEasingAnimation

 public void ScaleEasingAnimation(FrameworkElement element, double from, double to)
 {
     ScaleTransform scale = new ScaleTransform();
     element.RenderTransform = scale;
     element.RenderTransformOrigin = new Point(0.5, 0.5);//定义圆心位置
     DoubleAnimation scaleAnimation = new DoubleAnimation()
     {
         From = from,                                 //起始值
         To = to,                                     //结束值
         //EasingFunction = easing,                    //缓动函数
         Duration = new TimeSpan(0, 0, 0, 0, 200)    //动画播放时间
     };
     AnimationClock clock = scaleAnimation.CreateClock();
     scale.ApplyAnimationClock(ScaleTransform.ScaleXProperty, clock);
     scale.ApplyAnimationClock(ScaleTransform.ScaleYProperty, clock);
 }
开发者ID:TomasQin,项目名称:CustomOpenCards,代码行数:16,代码来源:SingleCardControl.xaml.cs

示例8: AnimationExpressionFillBehaviorStopTest

        public void AnimationExpressionFillBehaviorStopTest()
        {
            DoubleAnimation animation = new DoubleAnimation { From = 10, To = 20, FillBehavior = FillBehavior.Stop };

            TestRootClock rootClock = new TestRootClock();
            rootClock.Tick(TimeSpan.FromSeconds(1));

            FrameworkElement element = new FrameworkElement();
            Assert.AreEqual(Double.NaN, element.Width);

            AnimationTimelineClock animationClock = (AnimationTimelineClock)animation.CreateClock();
            element.ApplyAnimationClock(FrameworkElement.WidthProperty, animationClock);
            animationClock.Begin(rootClock);

            rootClock.Tick(TimeSpan.FromSeconds(1));
            Assert.AreEqual(10, element.Width);

            rootClock.Tick(TimeSpan.FromSeconds(2));
            Assert.AreEqual(Double.NaN, element.Width);
        }
开发者ID:highzion,项目名称:Granular,代码行数:20,代码来源:AnimationExpressionTest.cs

示例9: InitAnimation

        private void InitAnimation()
        {
            var animation = new DoubleAnimation
            {
                From = -100,
                To = _window.ActualWidth + 100,
                RepeatBehavior = RepeatBehavior.Forever
            };

            double duration = _window.ActualWidth/90;
            if (duration < 1)
                duration = 1;

            animation.Duration = new Duration(TimeSpan.FromSeconds((int) duration));

            var clock = animation.CreateClock();

            RadioTitle.ApplyAnimationClock(Canvas.LeftProperty, clock);

            clock.Controller.Begin();
        }
开发者ID:Tauron1990,项目名称:Radio-Streamer,代码行数:21,代码来源:RadioPlayerView.xaml.cs

示例10: ScaleEasingAnimation

 public static  void ScaleEasingAnimation(FrameworkElement element)
 {
     ScaleTransform scale = new ScaleTransform();
     element.RenderTransform = scale;
     element.RenderTransformOrigin = new Point(0.5, 0.5);//定义圆心位置
     EasingFunctionBase easing = new ElasticEase()
     {
         EasingMode = EasingMode.EaseOut,            //公式
         Oscillations = 1,                           //滑过动画目标的次数
         Springiness = 10                             //弹簧刚度
     };
     DoubleAnimation scaleAnimation = new DoubleAnimation()
     {
         From = 0,                                 //起始值
         To = 1,                                     //结束值
         EasingFunction = easing,                    //缓动函数
         Duration = new TimeSpan(0, 0, 0, 1, 200)    //动画播放时间
     };
     AnimationClock clock = scaleAnimation.CreateClock();
     scale.ApplyAnimationClock(ScaleTransform.ScaleXProperty, clock);
     scale.ApplyAnimationClock(ScaleTransform.ScaleYProperty, clock);
 }
开发者ID:chijianfeng,项目名称:PNManager,代码行数:22,代码来源:AnimationUtil.cs

示例11: Init

        public void Init(MyModel mm)
        {
            this.mm = mm;

            //Transform3DGroup t3dg = (Transform3DGroup)this.mm.m3dg.Transform;
            //ScaleTransform3D st3d = (ScaleTransform3D)t3dg.Children[0];
            if (mm.scaleTransform != null)
            {
                ScaleTransform3D st3d = mm.scaleTransform;
                st3d.ScaleX = 0.01;
                st3d.ScaleY = 0.01;
                st3d.ScaleZ = 0.01;

                DoubleAnimation dax = new DoubleAnimation(0.01, 10, new Duration(new TimeSpan(0, 0, 2)));
                dax.AutoReverse = true;
                dax.RepeatBehavior = RepeatBehavior.Forever;
                clock = dax.CreateClock();
                st3d.ApplyAnimationClock(ScaleTransform3D.ScaleXProperty, clock);
                st3d.ApplyAnimationClock(ScaleTransform3D.ScaleYProperty, clock);
                st3d.ApplyAnimationClock(ScaleTransform3D.ScaleZProperty, clock);
                clock.Controller.Begin();
            }
        }
开发者ID:pyephyomaung,项目名称:som-ar,代码行数:23,代码来源:PyramidGrow.cs

示例12: ClockPlay

 public void ClockPlay()
 {
     DoubleAnimation tmp = new DoubleAnimation(1, 1, TimeSpan.FromMinutes(3));
     tmp.RepeatBehavior = RepeatBehavior.Forever;
     mainClock = tmp.CreateClock();
     mainClock.CurrentTimeInvalidated += mainClock_CurrentTimeInvalidated;
     demoTxt.ApplyAnimationClock(OpacityProperty, clock);
 }
开发者ID:iceriver102,项目名称:alta-mtc-version-2,代码行数:8,代码来源:Player.xaml.cs

示例13: showMouse

 private void showMouse(object sender, MouseEventArgs e)
 {
     Mouse.OverrideCursor = Cursors.Arrow;
     if (ClockMouse != null && ClockMouse.CurrentState == ClockState.Active)
     {
         ClockMouse.Controller.Stop();
     }
     DoubleAnimation daHideControl = new DoubleAnimation(1, 0, TimeSpan.FromSeconds(5));
     ClockMouse = daHideControl.CreateClock();
     ClockMouse.Completed += (o, s) =>
     {
         Mouse.OverrideCursor = Cursors.None;
     };
     demoTxt.ApplyAnimationClock(OpacityProperty, ClockMouse);
 }
开发者ID:iceriver102,项目名称:alta-mtc-version-2,代码行数:15,代码来源:Player.xaml.cs

示例14: BeginIndicatorValueChangedAnimation

        /// <summary>
        /// 播放指示条动画
        /// </summary>
        /// <param name="Angle"></param>
        void BeginIndicatorValueChangedAnimation(double Angle)
        {
            if (Angle < 5)  // 如果EndAngle小于5度,则直接显示角度值,QuinticEase会造成过冲,EndAngle会变成负值,造成闪动
            {
                /* 如果上一个动画还在执行中,则先停止动画
                 * 否则执行中的动画可能再次更改EndAngle
                 */
                if (animationclock != null && animationclock.CurrentState != ClockState.Stopped)
                    animationclock.Controller.Stop();

                IndicatorBar.EndAngle = Angle;
            }
            else
            {
                animation = new DoubleAnimation();
                animation.Duration = new Duration(TimeSpan.FromMilliseconds(500));
                animation.To = Angle;

                // QuinticEase ease = new QuinticEase();
                ElasticEase ease = new ElasticEase() { Oscillations = 2, Springiness = 5 };
                ease.EasingMode = EasingMode.EaseOut;
                animation.EasingFunction = ease;

                animationclock = animation.CreateClock();
                animationclock.Completed += animationclock_Completed;

                IndicatorBar.ApplyAnimationClock(Arc.EndAngleProperty, animationclock, HandoffBehavior.SnapshotAndReplace);
                animationclock.Controller.Begin();
            }
        }
开发者ID:35408EF66CCE4377B1E3C2495CA1C18A,项目名称:XuanJiYi_PC,代码行数:34,代码来源:IndicatorMeter.xaml.cs

示例15: OnRender

        /// <summary>
        /// <see cref="Shape.OnRender"/>
        /// </summary>
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            if (IsAnimated)
            {
                var pathGeometry = polylineGeometry as PathGeometry;

                if (pathGeometry != null)
                {
                    var startPoint = Points.FirstOrDefault(); // Each dot starts moving from the first point of the polyline.
                    var anumationDuration = new Duration(TimeSpan.FromSeconds(length / DotSpeed));
                    var relativeDelay = DotInterval / DotSpeed; // The time span between the start moments of the animation for two sequential dots.
                    var dotCount = (int)(length / DotInterval);

                    for (var i = 0; i < dotCount; i++)
                    {
                        var animationDelay = TimeSpan.FromSeconds(i * relativeDelay);
                        var centerAnimation = new PointAnimationUsingPath // Animate the center of the dot to move along the polyline.
                        {
                            PathGeometry = pathGeometry,
                            Duration = anumationDuration,
                            RepeatBehavior = RepeatBehavior.Forever,
                            BeginTime = animationDelay // Delaying animation prevents all dots from starting moving at the same time.
                        };

                        // A hacky way to hide the dot while it's waiting on the start - just set its radius to zero and restore back when it starts moving.
                        var radiusAnimation = new DoubleAnimation(0.0, DotRadius, TimeSpan.Zero)
                        {
                            BeginTime = animationDelay
                        };
                        var centerAnimationClock = centerAnimation.CreateClock();
                        var radiusAnimationClock = radiusAnimation.CreateClock();

                        // Draw the dot at the beginning of the line. Will have the same fill as line stroke and no border.
                        drawingContext.DrawEllipse(Stroke, EmptyPen, startPoint, centerAnimationClock, 0.0, radiusAnimationClock, 0.0, radiusAnimationClock);
                    }
                }
            }
        }
开发者ID:akravch,项目名称:Playground,代码行数:43,代码来源:AnimatedPolyline.cs


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