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


C# TextBlock.BeginAnimation方法代码示例

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


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

示例1: animationFadeText

 private void animationFadeText(TextBlock text, double from, double to, int duration)
 {
     DoubleAnimation animationFade = new DoubleAnimation();
     animationFade.From = from;
     animationFade.To = to;
     animationFade.Duration = new Duration(TimeSpan.FromMilliseconds(duration));
     text.BeginAnimation(Button.OpacityProperty, animationFade);
 }
开发者ID:waynenguyen,项目名称:EzyGoEzy,代码行数:8,代码来源:MainWindow.xaml.cs

示例2: CreateMessagePanels

        private void CreateMessagePanels()
        {
            Messages messages = new Messages(this.session);

            MessageObjects allobjects = messages.GetAllMessage();
            List<Message> msgs  = allobjects.Messages;
            int index = rand.Next(msgs.Count);
            Message msg = msgs[index];

            TextBlock tb = new TextBlock();
            tb.Text = msg.Body.Plain;
            tb.FontSize = 14;

            this.MainCanvas.Children.Add(tb);

            double centerX = this.MainCanvas.ActualWidth / 2.0;
            double centerY = this.MainCanvas.ActualHeight / 2.0;

            double offsetX = 16 - rand.Next(32);
            double offsetY = 16 - rand.Next(32);

            //tb.SetValue(Canvas.LeftProperty, centerX + offsetX);
            //tb.SetValue(Canvas.TopProperty, centerY + offsetY);
            tb.SetValue(Canvas.LeftProperty, centerX );
            tb.SetValue(Canvas.TopProperty, centerY );

            double duration = 6.0 + 10.0 * rand.NextDouble();
            double delay = 16.0 * rand.NextDouble();
            //TranslateTransform offsetTransform = new TranslateTransform();
            //DoubleAnimation offsetXAnimation = new DoubleAnimation(0.0, -256.0, new Duration(TimeSpan.FromSeconds(duration)));
            //offsetXAnimation.RepeatBehavior = RepeatBehavior.Forever;
            //offsetXAnimation.BeginTime = TimeSpan.FromSeconds(delay);
            //offsetTransform.BeginAnimation(TranslateTransform.XProperty, offsetXAnimation);
            //offsetTransform.BeginAnimation(TranslateTransform.YProperty, offsetXAnimation);
            //tb.RenderTransform = offsetTransform;
            DoubleAnimation opacityAnimation = new DoubleAnimation(0.0, 1.0, new Duration(TimeSpan.FromSeconds(4.0)));
            opacityAnimation.RepeatBehavior = RepeatBehavior.Forever;
            tb.BeginAnimation(TextBlock.OpacityProperty, opacityAnimation);
        }
开发者ID:changman,项目名称:yammyy,代码行数:39,代码来源:AutoView.xaml.cs


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