2011-08-14 5 views
0

코드에서 dropshadoweffect의 불투명도에 애니메이션 효과를 적용하려면 어떻게해야합니까? 나는 이미지와 텍스트 블록을 포함하는 UI에 동적으로 스택 패널을 생성하고있다. 이미지에 그림자 효과를 적용했습니다. 불투명도를 애니메이션으로 적용하고 싶습니다. 여기에 내가 가진 무엇 : 아마C# 코드에서 dropshadoweffect의 불투명도를 애니메이트하는 방법은 무엇입니까?

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); 
+0

포인트 이미지를하지 영향을 할 수 있습니다. – Code0987

답변

1
dSE.BeginAnimation(DropShadowEffect.OpacityProperty, animateOpacity); 

...

가 (당신이 효과를 애니메이션하는이 아닌 이미지)

+0

답장을 보내 주셔서 감사합니다! – Ben

+0

@ 벤 : 음, 물론 이죠. –

+0

왜 이것이 정답으로 표시되지 않습니까? @ 벤 –

관련 문제