简体   繁体   中英

How to animate the width and height of an ellipse in an UWP app

I'm trying to animate the width and height property of an Ellipse element in XAML. I found a few examples online, but none of them seems to work.
I'm sure I'm missing only something little and stupid. Here my animation in 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>

The Ellipse element in XAML:

<Ellipse x:Name="OuterEllipse"  Width="259" Height="259" Fill="#FF5AA1BA" />

And how I try to start the animation in the code behind:

PressFormLogin.Begin();

It's the first time that I'm using a animation in one of my applications, it would be nice if someone could give me a push in the right direction.

Try to set EnableDependentAnimation="True" for your DoubleAnimation . See EnableDependentAnimation on MSDN .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM