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


C# Window.BeginAnimation方法代码示例

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


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

示例1: NewWIdowsSlidFront

        public void NewWIdowsSlidFront(Window panal, double centerlocation, double duration)
        {
            DoubleAnimation slider = new DoubleAnimation();
            slider.To = centerlocation;

            slider.DecelerationRatio = .7;
            slider.From = -panal.Width - 100;
            slider.Duration = new Duration(TimeSpan.FromMilliseconds(duration));
            panal.BeginAnimation(Window.LeftProperty, slider);
        }
开发者ID:Creative2,项目名称:tab_slider,代码行数:10,代码来源:Effects.cs

示例2: HideWindow

        /// <summary>
        /// 隐藏窗口
        /// </summary>
        /// <param name="window">要隐藏的窗口</param>
        public void HideWindow(Window window)
        {
            ObjectAnimationUsingKeyFrames visAni = new ObjectAnimationUsingKeyFrames();
            visAni.KeyFrames.Add(new DiscreteObjectKeyFrame(Visibility.Hidden, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.3))));
            window.BeginAnimation(Window.VisibilityProperty, visAni);

            DoubleAnimationUsingKeyFrames alphaAni = new DoubleAnimationUsingKeyFrames();
            CubicEase ef = new CubicEase();
            alphaAni.KeyFrames.Add(new EasingDoubleKeyFrame(1, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)), ef));
            alphaAni.KeyFrames.Add(new EasingDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.3)), ef));
            window.BeginAnimation(Window.OpacityProperty, alphaAni);
        }
开发者ID:g4idrijs,项目名称:UltraDemo,代码行数:16,代码来源:MainWindow.xaml.cs

示例3: animateWindowHeight

        /// <summary>
        /// Animates the window's height
        /// </summary>
        /// <param name="window">The window to animate</param>
        /// <param name="height">The height to animate the window to</param>
        /// <param name="duration">The duration for the animation</param>
        /// <param name="callback">An optional callback to be executed when the animation finishes</param>
        private void animateWindowHeight(Window window, double height, double duration, Action callback = null)
        {
            window.BeginInit();
            window.Dispatcher.BeginInvoke((Action)(() =>
            {
                DoubleAnimation windowAnimation = new DoubleAnimation();
                windowAnimation.Duration = new Duration(TimeSpan.FromSeconds(duration));
                windowAnimation.From = window.Height;
                windowAnimation.To = height;
                windowAnimation.FillBehavior = FillBehavior.HoldEnd;

                //If a callback is passed, execute it using a lambda expression
                if (callback != null)
                {
                    windowAnimation.Completed += (s, e) => callback();
                }
                window.BeginAnimation(Window.HeightProperty, windowAnimation);
            }), null);
            window.EndInit();
        }
开发者ID:aaronjwood,项目名称:periodkiller,代码行数:27,代码来源:PeriodKiller.xaml.cs

示例4: Animate

 public static void Animate(Window _this, float _time, float from, float to, DependencyProperty property , bool isClosing)
 {
     DoubleAnimation da = new DoubleAnimation(from, to, new Duration(TimeSpan.FromSeconds(_time)));
     da.Completed += (s, e) =>
     {
        
        _this.Close();
     };
     _this.BeginAnimation(property, da);
   
 }
开发者ID:jkevinp,项目名称:ergoMC,代码行数:11,代码来源:Helpers.cs

示例5: WIdowsSlidBack

 public void WIdowsSlidBack(Window panal, double duration)
 {
     DoubleAnimation slider = new DoubleAnimation();
     slider.To = -panal.Width - 100;
     slider.From = panal.Left;
     slider.AccelerationRatio = .4;
     slider.Duration = new Duration(TimeSpan.FromMilliseconds(duration));
     panal.BeginAnimation(Window.LeftProperty, slider);
 }
开发者ID:Creative2,项目名称:tab_slider,代码行数:9,代码来源:Effects.cs


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