Windows Phone 8.1 动画

network | | 访问(61)
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid.Resources>
        <Storyboard x:Name="storyboard">
            <PointAnimationUsingKeyFrames Storyboard.TargetName="myLinearGradientBrush" 
                                Storyboard.TargetProperty="StartPoint"  EnableDependentAnimation="True"
                                RepeatBehavior="Forever" >
                <DiscretePointKeyFrame Value="0.1,0.3" KeyTime="0:0:0"/>
                <DiscretePointKeyFrame Value="0.2,0.4" KeyTime="0:0:1"/>
                <DiscretePointKeyFrame Value="0.3,0.5" KeyTime="0:0:2"/>
                <DiscretePointKeyFrame Value="0.4,0.6" KeyTime="0:0:3"/>
                <DiscretePointKeyFrame Value="0.5,0.7" KeyTime="0:0:4"/>
                <DiscretePointKeyFrame Value="0.6,0.8" KeyTime="0:0:5"/>
                <DiscretePointKeyFrame Value="0.7,0.9" KeyTime="0:0:6"/>
            </PointAnimationUsingKeyFrames>
        </Storyboard>
    </Grid.Resources>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,35,0,28">
        <TextBlock Text="我的应用程序" FontSize="20"  />
        <TextBlock Text="动画" FontSize="60" />
    </StackPanel>

    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <Ellipse x:Name="ellipse" >
            <Ellipse.Fill>
                <LinearGradientBrush  x:Name="myLinearGradientBrush"
                                     StartPoint="0,0" EndPoint="1,0">
                    <LinearGradientBrush.GradientStops>
                        <GradientStop Color="White" Offset="0.001"></GradientStop>
                        <GradientStop Color="Blue" Offset="1"></GradientStop>
                    </LinearGradientBrush.GradientStops>
                </LinearGradientBrush >
            </Ellipse.Fill>
        </Ellipse>
        <Button Content="启动动画" Height="100" Click="Button_Click_1"></Button>
    </Grid>
</Grid>
private void Button_Click_1(object sender, RoutedEventArgs e) {
    storyboard.Begin();
}