Linear、Discrete、Spline的区别

来源:互联网 发布:pdf.js跨域 java 编辑:程序博客网 时间:2024/05/21 23:34

<StackPanel Loaded="Start_Animation" Background="White" x:Name="stackPanel">
            <StackPanel.Resources>
                <Storyboard x:Name="colorStoryboard">
                    <ColorAnimationUsingKeyFrames BeginTime="0:0:0" Storyboard.TargetName="stackPanel" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">

<!-- Go from green to red in the first 2 seconds. LinearColorKeyFrame creates a smooth, linear animation between values. -->

                        <LinearColorKeyFrame Value="Red" KeyTime="0:0:2"/>

<!-- In the next half second, go to yellow. DiscreteColorKeyFrame creates a sudden jump between values. -->

                        <DiscreteColorKeyFrame Value="Yellow" KeyTime="0:0:2.5"/>

<!-- In the final 2 seconds of the animation, go from yellow back to green. SplineColorKeyFrame creates a variable transition between values depending on the KeySpline property. In this example,the animation starts off slow but toward the end of the time segment, it speeds up exponentially.-->

                        <SplineColorKeyFrame Value="Green" KeyTime="0:0:4.5" KeySpline="0.6,0.0 0.9,0.0"/>
                    </ColorAnimationUsingKeyFrames>
                </Storyboard>
            </StackPanel.Resources>
</StackPanel> 

原创粉丝点击