当前位置:首页 > c#代码库 > WPF > 文字阴影动画效果

文字阴影动画效果

点击次数:1628  更新日期:2018-12-05
DoubleAnimation doubleAnimation = new DoubleAnimation() { From = 0, To = 20, AutoReverse = true, Duration = new Duration(TimeSpan.FromSeconds(0.5)) };
//阴影效果
DropShadowEffect effect = new DropShadowEffect() { Direction = 0, ShadowDepth = 0, Color = Colors.Gray };
//为textblock1添加阴影效果
textBlock1.Effect = effect;
//为阴影效果的 BlurRadius属性执行动画
effect.BeginAnimation(DropShadowEffect.BlurRadiusProperty, doubleAnimation);