C# 如何在C代码中设置dropshadoweffect的不透明度动画?
如何在代码中设置DropShadow效果不透明度的动画。我在UI中动态创建StackPanel,其中包含图像和文本块。我已经对图像应用了DropShadow效果,我想为不透明度设置动画。以下是我所拥有的:C# 如何在C代码中设置dropshadoweffect的不透明度动画?,c#,wpf,animation,C#,Wpf,Animation,如何在代码中设置DropShadow效果不透明度的动画。我在UI中动态创建StackPanel,其中包含图像和文本块。我已经对图像应用了DropShadow效果,我想为不透明度设置动画。以下是我所拥有的: Image img = ch.ChannelLogo; //Create the image for the button img.Height = channelStackPnl.Height * .66; DropShadowEffect dSE = new DropShadowEff
Image img = ch.ChannelLogo; //Create the image for the button
img.Height = channelStackPnl.Height * .66;
DropShadowEffect dSE = new DropShadowEffect();
dSE.Color = Colors.White;
dSE.Direction = 25;
dSE.ShadowDepth = 10;
dSE.Opacity = .40;
img.Effect = dSE;
DoubleAnimation animateOpacity = new DoubleAnimation();
animateOpacity.From = 0;
animateOpacity.To = 1;
animateOpacity.AutoReverse = true;
animateOpacity.RepeatBehavior = RepeatBehavior.Forever;
animateOpacity.Duration = new Duration(new TimeSpan(0, 0, 0, 0, 400));
//Here's where I am stuck. How do I specifically target the opacity of the effect propery?
img.BeginAnimationimg.BeginAnimation(DropShadowEffect.OpacityProperty,animateOpacity);
也许
(您正在制作效果动画,而不是图像)感谢您抽出时间回复!为什么这不是正确答案@本
dSE.BeginAnimation(DropShadowEffect.OpacityProperty, animateOpacity);