开发者

How to put animation effects on C# in WPF

I am using wpf application where i am using an image. I开发者_StackOverflow社区 want to put some animation effects on it. When a user clicks on button it dissapear from the screen and move away from left to right or some this kind of animation. What classes do i need to use. Can I use silverlight or flash or something else here


DoubleAnimation TopAnimation = new DoubleAnimation();
TopAnimation.From = YourImage.Top;
TopAnimation.To = WhereYouWantItToEndUp
TopAnimation.Duration = TimeSpan.FromSeconds(AnDuration);

YourImage.BeginAnimation(YourImage.TopProperty, TopAnimation);

And you can chain a bunch of them together and they will all happen at the same time.

You can also do it in xaml

If you want to know when its completed add a listener to the completed event of the animation

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜