|
|
|
@ -12,6 +12,8 @@ namespace Avalonia.Animation.Animators |
|
|
|
/// </summary>
|
|
|
|
public class ISolidColorBrushAnimator : Animator<ISolidColorBrush?> |
|
|
|
{ |
|
|
|
private static readonly DoubleAnimator s_doubleAnimator = new DoubleAnimator(); |
|
|
|
|
|
|
|
public override ISolidColorBrush? Interpolate(double progress, ISolidColorBrush? oldValue, ISolidColorBrush? newValue) |
|
|
|
{ |
|
|
|
if (oldValue is null || newValue is null) |
|
|
|
@ -19,7 +21,9 @@ namespace Avalonia.Animation.Animators |
|
|
|
return progress >= 0.5 ? newValue : oldValue; |
|
|
|
} |
|
|
|
|
|
|
|
return new ImmutableSolidColorBrush(ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color)); |
|
|
|
return new ImmutableSolidColorBrush( |
|
|
|
ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color), |
|
|
|
s_doubleAnimator.Interpolate(progress, oldValue.Opacity, newValue.Opacity)); |
|
|
|
} |
|
|
|
|
|
|
|
public override IDisposable BindAnimation(Animatable control, IObservable<ISolidColorBrush?> instance) |
|
|
|
|