动画向前运行然后反转回原始状态

时间:2012-01-13 18:00:17

标签: .net wpf c#-4.0 animation .net-4.0

是否有任何简单的方法可以正常运行基于WPF故事板的动画,然后反向运行以将所有内容恢复到原始状态?

最好,我想以编程方式执行此操作:

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?

例如,您可能有一个动画,其中椭圆从左向右移动,并且您希望它在结尾处向后移动到它开始的位置:

enter image description here

2 个答案:

答案 0 :(得分:5)

您是否尝试过将AutoReverse设置为true

答案 1 :(得分:0)

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?