diff --git a/src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs b/src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs index 9c94823608..a8e618af27 100644 --- a/src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs +++ b/src/Avalonia.Visuals/Animation/Animators/SolidColorBrushAnimator.cs @@ -26,16 +26,17 @@ namespace Avalonia.Animation.Animators public override IDisposable Apply(Animation animation, Animatable control, IClock clock, IObservable match, Action onComplete) { + // Preprocess keyframe values to Color if the xaml parser converts them to ISCB. foreach (var keyframe in this) { - if (!(keyframe.Value is ISolidColorBrush)) - return Disposable.Empty; - - // Preprocess keyframe values to Color if the xaml parser converts them to ISCB. if (keyframe.Value is ISolidColorBrush colorBrush) { keyframe.Value = colorBrush.Color; } + else + { + return Disposable.Empty; + } } SolidColorBrush finalTarget;