I am using wpf application where i am using an image. I 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
A:
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
Dimestore Cowboy
2010-06-08 16:41:29
DoubleAnimation TopAnimation = new DoubleAnimation(); TopAnimation.From = 1.0; TopAnimation.To = 0.0; TopAnimation.Duration = TimeSpan.FromSeconds(5); TopAnimation.AutoReverse = true; TopAnimation.RepeatBehavior = RepeatBehavior.Forever; imgLeft1.BeginAnimation(System.Windows.Controls.Image.TopProperty , TopAnimation);it will give error at TopProperty
Chunmun Tyagi
2010-06-09 06:34:50