public override BoxShadow Interpolate(double progress, BoxShadow oldValue, BoxShadow newValue) { return(new BoxShadow { OffsetX = s_doubleAnimator.Interpolate(progress, oldValue.OffsetX, newValue.OffsetX), OffsetY = s_doubleAnimator.Interpolate(progress, oldValue.OffsetY, newValue.OffsetY), Blur = s_doubleAnimator.Interpolate(progress, oldValue.Blur, newValue.Blur), Spread = s_doubleAnimator.Interpolate(progress, oldValue.Spread, newValue.Spread), Color = s_colorAnimator.Interpolate(progress, oldValue.Color, newValue.Color), IsInset = s_boolAnimator.Interpolate(progress, oldValue.IsInset, newValue.IsInset) }); }
public override IGradientBrush?Interpolate(double progress, IGradientBrush?oldValue, IGradientBrush?newValue) { if (oldValue is null || newValue is null) { return(progress >= 0.5 ? newValue : oldValue); } switch (oldValue) { case IRadialGradientBrush oldRadial when newValue is IRadialGradientBrush newRadial: return(new ImmutableRadialGradientBrush( InterpolateStops(progress, oldValue.GradientStops, newValue.GradientStops), s_doubleAnimator.Interpolate(progress, oldValue.Opacity, newValue.Opacity), oldValue.Transform is { } ? new ImmutableTransform(oldValue.Transform.Value) : null, oldValue.SpreadMethod, s_relativePointAnimator.Interpolate(progress, oldRadial.Center, newRadial.Center), s_relativePointAnimator.Interpolate(progress, oldRadial.GradientOrigin, newRadial.GradientOrigin), s_doubleAnimator.Interpolate(progress, oldRadial.Radius, newRadial.Radius)));
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))); }
public override IGradientBrush?Interpolate(double progress, IGradientBrush?oldValue, IGradientBrush?newValue) { if (oldValue is null || newValue is null) { return(progress >= 0.5 ? newValue : oldValue); } switch (oldValue) { case IRadialGradientBrush oldRadial when newValue is IRadialGradientBrush newRadial: return(new ImmutableRadialGradientBrush( InterpolateStops(progress, oldValue.GradientStops, newValue.GradientStops), s_doubleAnimator.Interpolate(progress, oldValue.Opacity, newValue.Opacity), oldValue.SpreadMethod, s_relativePointAnimator.Interpolate(progress, oldRadial.Center, newRadial.Center), s_relativePointAnimator.Interpolate(progress, oldRadial.GradientOrigin, newRadial.GradientOrigin), s_doubleAnimator.Interpolate(progress, oldRadial.Radius, newRadial.Radius))); case IConicGradientBrush oldConic when newValue is IConicGradientBrush newConic: return(new ImmutableConicGradientBrush( InterpolateStops(progress, oldValue.GradientStops, newValue.GradientStops), s_doubleAnimator.Interpolate(progress, oldValue.Opacity, newValue.Opacity), oldValue.SpreadMethod, s_relativePointAnimator.Interpolate(progress, oldConic.Center, newConic.Center), s_doubleAnimator.Interpolate(progress, oldConic.Angle, newConic.Angle))); case ILinearGradientBrush oldLinear when newValue is ILinearGradientBrush newLinear: return(new ImmutableLinearGradientBrush( InterpolateStops(progress, oldValue.GradientStops, newValue.GradientStops), s_doubleAnimator.Interpolate(progress, oldValue.Opacity, newValue.Opacity), oldValue.SpreadMethod, s_relativePointAnimator.Interpolate(progress, oldLinear.StartPoint, newLinear.StartPoint), s_relativePointAnimator.Interpolate(progress, oldLinear.EndPoint, newLinear.EndPoint))); default: return(progress >= 0.5 ? newValue : oldValue); } }