本文整理汇总了C#中System.Windows.Media.Animation.ColorAnimation.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ColorAnimation.SetValue方法的具体用法?C# ColorAnimation.SetValue怎么用?C# ColorAnimation.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Animation.ColorAnimation
的用法示例。
在下文中一共展示了ColorAnimation.SetValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartTimer
private void StartTimer()
{
DoubleAnimation daValueProperty = new DoubleAnimation();
daValueProperty.From = 200;
daValueProperty.To = 0;
daValueProperty.Duration = TimeSpan.FromSeconds(200);
daValueProperty.SetValue(Storyboard.TargetNameProperty, "progressBarTimeLeft");
daValueProperty.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Value"));
ColorAnimation caForegroundProperty = new ColorAnimation();
caForegroundProperty.To = Colors.Red;
caForegroundProperty.BeginTime = TimeSpan.FromSeconds(170);
caForegroundProperty.SetValue(Storyboard.TargetNameProperty, "progressBarTimeLeft");
caForegroundProperty.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Foreground.Color"));
//gör så att mot slutet börja progressbaren blinka
//DoubleAnimation daOpacityProperty = new DoubleAnimation();
//daOpacityProperty.From = 1;
//daOpacityProperty.To = 0;
//daOpacityProperty.Duration = TimeSpan.FromMilliseconds(900);
//daOpacityProperty.AutoReverse = true;
//daOpacityProperty.RepeatBehavior = RepeatBehavior.Forever;
//daOpacityProperty.BeginTime = TimeSpan.FromSeconds(185);
//daOpacityProperty.SetValue(Storyboard.TargetNameProperty, "progressBarTimeLeft");
//daOpacityProperty.SetValue(Storyboard.TargetPropertyProperty, new PropertyPath("Opacity"));
App.TimerStoryboard = new Storyboard();
App.TimerStoryboard.Children.Add(daValueProperty);
App.TimerStoryboard.Children.Add(caForegroundProperty);
//App.TimerStoryboard.Children.Add(daOpacityProperty);
App.TimerStoryboard.Duration = TimeSpan.FromSeconds(200);
//sb.Completed += new EventHandler(GameOver);
App.TimerStoryboard.Begin(gameGrid, true);
}