如何保存动画更改 [英] How save animation changes

查看:58
本文介绍了如何保存动画更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,当发生点击时,我尝试缓慢地将带有动画的椭圆围绕(0,0)旋转.为此,我在RotateTransform.AngleProperty上使用DoubleAnimation,如下所示:

i try to rotate a ellipse with animation around (0,0) slowly for example when a click occured. for this i use DoubleAnimation on RotateTransform.AngleProperty like this :

DoubleAnimation da = new DoubleAnimation();
da.Duration = new Duration(TimeSpan.FromSeconds(2));
da.To = -50;
RotateTransform rt = new RotateTransform();
rt.BeginAnimation(RotateTransform.AngleProperty, da);
rt.CenterX = ellipse.Width / 2 - ellipse.Margin.Left / 2;
rt.CenterY = ellipse.Height / 2 - ellipse.Margin.Top / 2;
ellipse.RenderTransform = rt;



但是当完成修复时,椭圆的Margin属性不会改变.

我想在动画结束到新位置后动态更改边距.

怎么办?

谢谢.



but when aniamtion finished Margin property of ellipse not change.

i want to dynamically change Margin when animation finished to the new location.

how do it?

thanks.

推荐答案

我没看到问题.属性System.Windos.FrameworkElement.Margin是类型为System.Windows.Thickness的读/写属性;因此您可以自由为其分配新值.计算动画结束后期望的值,并将其分配给您的Ellipse或其他形状:
http://msdn.microsoft.com/en-us/library/system. windows.frameworkelement.margin.aspx [ ^ ].

—SA
I don''t see a problem. The property System.Windos.FrameworkElement.Margin is a read/write property of the type System.Windows.Thickness; so you can freely assign a new value to it. Calculate the value you expect to have after the end of animation and assign it to your Ellipse or other shape:
http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.margin.aspx[^].

—SA


这篇关于如何保存动画更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆