The LinearColorKeyFrame class has these types of members:
The LinearColorKeyFrame class has these constructors.
|LinearColorKeyFrame||Initializes a new instance of the LinearColorKeyFrame class.|
The LinearColorKeyFrame class has these methods. It also inherits methods from the Object class.
|ClearValue||Clears the local value of a dependency property. (Inherited from DependencyObject)|
|GetAnimationBaseValue||Returns any base value established for a dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject)|
|GetValue||Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject)|
|ReadLocalValue||Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject)|
|SetValue||Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject)|
The LinearColorKeyFrame class has these properties.
|Read-only||Gets the CoreDispatcher that this object is associated with. (Inherited from DependencyObject)|
|Read/write||Gets or sets the time at which the key frame's target Value should be reached. (Inherited from ColorKeyFrame)|
|Read/write||Gets or sets the key frame's target value. (Inherited from ColorKeyFrame)|
Key-frame animations permit more than one target value that is reached at a point along the animation timeline. In other words each key frame can specify a different intermediate value, and the last key frame reached is the final animation value. By specifying multiple values to animate, you can make more complex animations. You'd typically have at least two keyframes in a ColorAnimationUsingKeyFrames with LinearColorKeyFrame, otherwise a ColorAnimation would have been simpler.
For more info on how to use key-frame animations, see Key-frame animations and easing function animations.
During the first two seconds, LinearColorKeyFrame gradually changes the color from green to red. Linear key frames like LinearColorKeyFrame create a smooth linear transition between values.
During the end of the next half second, DiscreteColorKeyFrame quickly changes the color from red to yellow. Discrete key frames like DiscreteColorKeyFrame create sudden changes between values; the animation occurs quickly and has no interpolation between values at all.
During the final two seconds, SplineColorKeyFrame changes the color again, this time from yellow back to green. Spline key frames like SplineColorKeyFrame create a variable transition between values according to the values of the KeySpline property. A KeySpline provides a way to alter the relationship of time versus value during the animation duration to be nonlinear, and in particular the relationship can be a curve that would be difficult to produce with individual key frames. In this example, the change in color begins slowly and speeds up exponentially toward the end of the time segment.
<StackPanel x:Name="myStackPanel" Background="Red" Loaded="Start_Animation"> <StackPanel.Resources> <Storyboard x:Name="colorStoryboard"> <ColorAnimationUsingKeyFrames Storyboard.TargetName="myStackPanel" 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="Blue" KeyTime="00:00:02" /> <!-- In the next half second, go to yellow. DiscreteColorKeyFrame creates a sudden jump between values. --> <DiscreteColorKeyFrame Value="Yellow" KeyTime="00:00: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="00:00:4.5" KeySpline="0.6,0.0 0.9,0.00" /> </ColorAnimationUsingKeyFrames> </Storyboard> </StackPanel.Resources> </StackPanel>
Minimum supported client
|Windows 8 [Windows Store apps only]|
Minimum supported server
|Windows Server 2012 [Windows Store apps only]|
Minimum supported phone
|Windows Phone 8.1 [Windows Runtime apps only]|
- Storyboarded animations
- Key-frame animations and easing function animations