WPF 中的简单的动画

XMAL代码

<Window x:Class="RibbonApp.View.Animaion.WinEclipse"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="WinEclipse" Height="300" Width="300">
    <Grid>
        <Ellipse Height="50" Width="100" Margin="89,106,89,0" VerticalAlignment="Top">
            <Ellipse.Fill>
                <SolidColorBrush x:Name="ellipsebrush" Color="SteelBlue"></SolidColorBrush>
            </Ellipse.Fill>
            <Ellipse.Triggers>
                <EventTrigger RoutedEvent="Ellipse.Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard Duration="00:00:06" RepeatBehavior="Forever">
                                <DoubleAnimation Storyboard.TargetProperty="Ellipse.Width"
                                                 Duration="0:0:3" AutoReverse="True"
                                                  FillBehavior="Stop" RepeatBehavior="Forever" AccelerationRatio="0.9"
                                                 DecelerationRatio="0.1" From="100"  To="300">
                                   
                                </DoubleAnimation>
                                <ColorAnimation Storyboard.TargetName="ellipsebrush"  Duration="0:0:3"
                                                 AutoReverse="True" FillBehavior="Stop" RepeatBehavior="Forever"
                                                 From="Yellow" To="Red">
                                    
                                </ColorAnimation>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Ellipse.Triggers>
        </Ellipse>
    </Grid>
</Window>

 

posted @ 2012-04-27 00:05  在 水 一 方  阅读(598)  评论(0编辑  收藏  举报