public ref class ColorKeyFrameAnimation sealed : KeyFrameAnimation
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 131072)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ColorKeyFrameAnimation final : KeyFrameAnimation
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 131072)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ColorKeyFrameAnimation : KeyFrameAnimation
Public NotInheritable Class ColorKeyFrameAnimation
Inherits KeyFrameAnimation
void ColorAnimation(SpriteVisual visual)
{
// Create the ColorKeyFrameAnimation
var colorAnimation = _compositor.CreateColorKeyFrameAnimation();
// Create the KeyFrames using Windows.UI.Color objects
colorAnimation.InsertKeyFrame(0.5f, Colors.Purple);
colorAnimation.InsertKeyFrame(1.0f, Colors.Cyan);
// Set the interpolation to go through the HSL space
colorAnimation.InterpolationColorSpace = CompositionColorSpace.Hsl;
colorAnimation.Duration = TimeSpan.FromSeconds(3);
// Apply the cubic-bezier to a KeyFrame
visual.Brush.StartAnimation("Color", colorAnimation);
}