Michael Goldshteyn
Michael Goldshteyn

Reputation: 74330

Animation run forward and then reverse back to original state

Is there any simple way to run a WPF storyboard based animation normally and then to run it in reverse to return all things to their original state?

Preferably, I would like to do this programatically:

Storyboard sb=new Storyboard();

...

sb.Begin();

// Now how to do I run sb in reverse, to move things to where they were 
// before the sb started?

For example, you might have an animation where an ellipse moves from left to right and you would like for it at the end to move back to the left, where it began:

enter image description here

Upvotes: 1

Views: 986

Answers (2)

Kishore Kumar
Kishore Kumar

Reputation: 12864

Storyboard sb=new Storyboard();
sb.AutoReverse=true;
...

sb.Begin();

 // Now how to do I run sb in reverse, to move things to where they were 
// before the sb started?

Upvotes: 0

brunnerh
brunnerh

Reputation: 184296

Have you tried setting AutoReverse to true then?

Upvotes: 5

Related Questions