public override IEnumerable <Timeline> CreateAnimation(FrameworkElement element) { var color = Colors.Aquamarine; var brush = (SolidColorBrush)element.GetValue(Control.ForegroundProperty); if (brush != null) { color = brush.Color; } return(new Timeline[] { element.AnimateColorProperty("(Control.Foreground).(SolidColorBrush.Color)") .AddEasingKeyFrame(Duration * 0.25, Colors.Red) .AddEasingKeyFrame(Duration * 0.5, Colors.Yellow) .AddEasingKeyFrame(Duration * 0.75, Colors.Blue) .AddEasingKeyFrame(Duration, color) }); }