如何在 UWP 应用程序中为椭圆的宽度和高度设置动画
How to animate the width and height of an ellipse in an UWP app
我正在尝试为 XAML 中的 Ellipse
元素设置宽度和高度 属性 的动画。我在网上找到了一些示例,但其中 none 似乎有效。
我确定我只缺少一些小而愚蠢的东西。这是我在 xaml 中的动画:
<Page.Resources>
<Storyboard x:Name="PressFormLogin" Storyboard.TargetName="OuterEllipse">
<DoubleAnimation Storyboard.TargetProperty="Width" From="259.0" To="149.0" Duration="0:0:5" />
<DoubleAnimation Storyboard.TargetProperty="Height" From="259.0" To="149.0" Duration="0:0:5" />
</Storyboard>
</Page.Ressources>
XAML中的Ellipse
元素:
<Ellipse x:Name="OuterEllipse" Width="259" Height="259" Fill="#FF5AA1BA" />
以及我如何尝试在后面的代码中启动动画:
PressFormLogin.Begin();
这是我第一次在我的一个应用程序中使用动画,如果有人能在正确的方向上推动我,那就太好了。
尝试为您的 DoubleAnimation
设置 EnableDependentAnimation="True"
。参见 EnableDependentAnimation on MSDN。
我正在尝试为 XAML 中的 Ellipse
元素设置宽度和高度 属性 的动画。我在网上找到了一些示例,但其中 none 似乎有效。
我确定我只缺少一些小而愚蠢的东西。这是我在 xaml 中的动画:
<Page.Resources>
<Storyboard x:Name="PressFormLogin" Storyboard.TargetName="OuterEllipse">
<DoubleAnimation Storyboard.TargetProperty="Width" From="259.0" To="149.0" Duration="0:0:5" />
<DoubleAnimation Storyboard.TargetProperty="Height" From="259.0" To="149.0" Duration="0:0:5" />
</Storyboard>
</Page.Ressources>
XAML中的Ellipse
元素:
<Ellipse x:Name="OuterEllipse" Width="259" Height="259" Fill="#FF5AA1BA" />
以及我如何尝试在后面的代码中启动动画:
PressFormLogin.Begin();
这是我第一次在我的一个应用程序中使用动画,如果有人能在正确的方向上推动我,那就太好了。
尝试为您的 DoubleAnimation
设置 EnableDependentAnimation="True"
。参见 EnableDependentAnimation on MSDN。