Several ways to do this.
with key frames:
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetProperty="Background.Color">
<DiscreteColorKeyFrame Value="Red" KeyTime="0:0:0" />
<DiscreteColorKeyFrame Value="Red" KeyTime="0:0:1" />
<LinearColorKeyFrame Value="White" KeyTime="0:0:2" />
</ColorAnimationUsingKeyFrames>
</Storyboard>
with two animations in sequence:
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="Background.Color"
From="Red" To="Red" Duration="0:0:1" />
<ColorAnimation Storyboard.TargetProperty="Background.Color"
To="White" BeginTime="0:0:1" Duration="0:0:1" />
</Storyboard>
with a custom easing function:
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="Background.Color"
From="Red" To="White" Duration="0:0:2">
<ColorAnimation.EasingFunction>
<local:CustomEasingFunction />
</ColorAnimation.EasingFunction>
</ColorAnimation>
</Storyboard>
In this case a function that shows the transition in the first half of duration and holds the value in the second half. Because the default EasingMode is EaseOut this function will then 'play' backwards.
public class CustomEasingFunction : EasingFunctionBase
{
public CustomEasingFunction() : base()
{ }
protected override double EaseInCore(double normalizedTime)
{
return (normalizedTime < 0.5)
? normalizedTime * 2
: 1;
}
protected override Freezable CreateInstanceCore()
{
return new CustomEasingFunction();
}
}