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


C# Control.BeginAnimation方法代码示例

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


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

示例1: animateControlOpacity

 /// <summary>
 /// Animates a control and allows control of the duration and opacity
 /// </summary>
 /// <param name="control">The control to be animated</param>
 /// <param name="opacity">The opacity value for the animation</param>
 /// <param name="duration">The duration for the animation</param>
 private void animateControlOpacity(Control control, double opacity, double duration)
 {
     control.BeginInit();
     control.Dispatcher.BeginInvoke((Action)(() =>
     {
         DoubleAnimation controlAnimation = new DoubleAnimation(opacity, new Duration(TimeSpan.FromSeconds(duration)));
         control.BeginAnimation(Label.OpacityProperty, controlAnimation);
     }), null);
     control.EndInit();
 }
开发者ID:aaronjwood,项目名称:periodkiller,代码行数:16,代码来源:PeriodKiller.xaml.cs

示例2: PlayAnimation

 /// <summary>
 /// 播放动画(DoubleAnimation)
 /// </summary>
 /// <param name="from">From</param>
 /// <param name="to">To</param>
 /// <param name="dp">依赖属性</param>
 /// <param name="target">对象</param>
 /// <param name="duration">时长</param>
 public static void PlayAnimation(double from, double to, DependencyProperty dp, Control target, double duration = 1)
 {
     DoubleAnimation animation = new DoubleAnimation()
     {
         From = from,
         To = to,
         Duration = TimeSpan.FromSeconds(duration),
         FillBehavior = FillBehavior.HoldEnd,
         AccelerationRatio = .5,
         EasingFunction = CAAnimation.be
     };
     target.BeginAnimation(dp, animation);
 }
开发者ID:ONEWateR,项目名称:FlowMonitor,代码行数:21,代码来源:CAAnimation.cs

示例3: DoFadeInAnimation

 // Plays the show animation for the given controls.
 private void DoFadeInAnimation(Control control)
 {
     // Fade in Animation.
     if (control.Opacity == 0)
     {
         DoubleAnimation da = new DoubleAnimation();
         da.From = 0;
         da.To = 1;
         da.Duration = new Duration(TimeSpan.FromSeconds(0.25));
         da.BeginTime = TimeSpan.FromMilliseconds(100);
         control.BeginAnimation(OpacityProperty, da);
     }
 }
开发者ID:mditrolio,项目名称:SimpleFOMOD,代码行数:14,代码来源:MainWindow.xaml.cs

示例4: Transition

        void Transition(Control outItem, Control inItem)
        {
            if (_transitionInProgress)
            {
                _transitionQueueOut.Enqueue(outItem);
                _transitionQueueIn.Enqueue(inItem);
            }
            else
            {
                _transitionInProgress = true;

                inItem.Opacity = 0;
                inItem.Visibility = Visibility.Visible;
                outItem.IsEnabled = false;

                DoubleAnimation daFadeOut = new DoubleAnimation();
                daFadeOut.To = 0;
                daFadeOut.Duration = TimeSpan.FromMilliseconds(1000);
                daFadeOut.Completed += delegate(object sender, EventArgs e)
                {
                    inItem.IsEnabled = true;
                    outItem.Visibility = Visibility.Collapsed;
                    _transitionInProgress = false;

                    if (_transitionQueueIn.Count > 0)
                    {
                        Transition(_transitionQueueOut.Dequeue(), _transitionQueueIn.Dequeue());
                    }
                };

                DoubleAnimation daFadeIn = new DoubleAnimation();
                daFadeIn.To = 1;
                daFadeIn.Duration = TimeSpan.FromMilliseconds(1000);

                outItem.BeginAnimation(FrameworkElement.OpacityProperty, daFadeOut);
                inItem.BeginAnimation(FrameworkElement.OpacityProperty, daFadeIn);
            }
        }
开发者ID:justinstaines,项目名称:Shumbi-Discover,代码行数:38,代码来源:CoreInterface.xaml.cs

示例5: Fade_Out_Control

 public static void Fade_Out_Control(Control c, int seconds)
 {
     Duration dur = new Duration(new TimeSpan(0, 0, 0, 0, seconds));
     fadeOut.Duration = dur;
     c.BeginAnimation(Control.OpacityProperty, fadeOut);
 }
开发者ID:m7schumacher,项目名称:FantasyFootballApplication,代码行数:6,代码来源:GUI_Animations.cs

示例6: FadeScrollElement

 public static void FadeScrollElement(double fromValue, double toValue, Control control)
 {
     DoubleAnimation da = new DoubleAnimation(fromValue, toValue, time);
     da.DecelerationRatio = acceleration;
     control.BeginAnimation(Control.OpacityProperty, da);
 }
开发者ID:Shoop123,项目名称:Reworder-C-Sharp,代码行数:6,代码来源:Modification.cs

示例7: SizeHeight

 public static void SizeHeight(double fromValue, double toValue, Control control)
 {
     DoubleAnimation da = new DoubleAnimation(fromValue, toValue, time);
     da.DecelerationRatio = acceleration;
     control.BeginAnimation(Control.HeightProperty, da);
 }
开发者ID:Shoop123,项目名称:Reworder-C-Sharp,代码行数:6,代码来源:Modification.cs

示例8: HideAnimation

 private void HideAnimation(Control AnimationObject, double start, double end)
 {
     DoubleAnimation da = new DoubleAnimation(start, end, TimeSpan.FromMilliseconds(200));
     AnimationObject.BeginAnimation(Control.WidthProperty, da);
 }
开发者ID:davidbarka,项目名称:projectFork,代码行数:5,代码来源:MainWindow.xaml.cs


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