public override SolidColorBrush?Interpolate(double progress, SolidColorBrush?oldValue, SolidColorBrush?newValue) { if (oldValue is null || newValue is null) { return(progress >= 0.5 ? newValue : oldValue); } return(new SolidColorBrush(ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color))); }
public override ISolidColorBrush Interpolate(double progress, ISolidColorBrush oldValue, ISolidColorBrush newValue) { if (oldValue is null || newValue is null) { return(oldValue); } return(new ImmutableSolidColorBrush(ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color))); }
void InitializeColorAnimator() { _colorAnimator = new ColorAnimator(); foreach (AnimatorKeyFrame keyframe in this) { _colorAnimator.Add(keyframe); } _colorAnimator.Property = SolidColorBrush.ColorProperty; }
public override ISolidColorBrush?Interpolate(double progress, ISolidColorBrush?oldValue, ISolidColorBrush?newValue) { if (oldValue is null || newValue is null) { return(progress >= 0.5 ? newValue : oldValue); } return(new ImmutableSolidColorBrush( ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color), s_doubleAnimator.Interpolate(progress, oldValue.Opacity, newValue.Opacity))); }
private IReadOnlyList <ImmutableGradientStop> InterpolateStops(double progress, IReadOnlyList <IGradientStop> oldValue, IReadOnlyList <IGradientStop> newValue) { var resultCount = Math.Max(oldValue.Count, newValue.Count); var stops = new ImmutableGradientStop[resultCount]; for (int index = 0, oldIndex = 0, newIndex = 0; index < resultCount; index++) { stops[index] = new ImmutableGradientStop( s_doubleAnimator.Interpolate(progress, oldValue[oldIndex].Offset, newValue[newIndex].Offset), ColorAnimator.InterpolateCore(progress, oldValue[oldIndex].Color, newValue[newIndex].Color)); if (oldIndex < oldValue.Count - 1) { oldIndex++; } if (newIndex < newValue.Count - 1) { newIndex++; } } return(stops); }
public override SolidColorBrush Interpolate(double progress, SolidColorBrush oldValue, SolidColorBrush newValue) { return(new SolidColorBrush(ColorAnimator.InterpolateCore(progress, oldValue.Color, newValue.Color))); }