/// <summary> /// Adds the values of the two specified brushes /// and returns a new brush, which represents the addition's /// result. /// </summary> /// <param name="a">the first brush.</param> /// <param name="b">The second brush.</param> /// <returns> /// The result of the addition. /// </returns> protected override sealed Brush AddValues(Brush a, Brush b) { BrushAnimationInput transformedInput = BrushAnimationInputTransformer.Transform(a, b); a = transformedInput.From; b = transformedInput.To; BrushAnimationValidator.ValidateBrushes(a, b); return(BrushAnimationHelper.Instance.AddValues(a, b)); }
/// <summary> /// Calculates the value of a key frame at the progress increment provided. /// </summary> /// <param name="baseValue">The value to animate from; typically the value of the previous key frame.</param> /// <param name="keyFrameProgress"> /// A value between 0.0 and 1.0, inclusive, that specifies the percentage of time /// that has elapsed for this key frame. /// </param> /// <returns>The output value of this key frame given the specified base value and progress.</returns> protected override Brush InterpolateValueCore(Brush baseValue, double keyFrameProgress) { if (keyFrameProgress <= 0) { return(baseValue); } if (keyFrameProgress >= 1) { return(Value); } BrushAnimationValidator.ValidateBrushes(baseValue, Value); return(BrushAnimationHelper.Instance.InterpolateValue(baseValue, Value, keyFrameProgress)); }
/// <summary> /// Calculates the value of a key frame at the progress increment provided. /// </summary> /// <param name="baseValue">The value to animate from; typically the value of the previous key frame.</param> /// <param name="easedProgress"> /// A value between 0.0 and 1.0, inclusive, that specifies the percentage of time /// that has elapsed for this key frame. /// This value has already been eased by the <see cref="IEasingFunction"/>. /// </param> /// <returns>The output value of this key frame given the specified base value and progress.</returns> protected override Brush InterpolateValueAfterEase(Brush baseValue, double easedProgress) { if (easedProgress <= 0) { return(baseValue); } if (easedProgress >= 1) { return(Value); } BrushAnimationValidator.ValidateBrushes(baseValue, Value); return(BrushAnimationHelper.Instance.InterpolateValue(baseValue, Value, easedProgress)); }
/// <summary> /// Calculates the value of a key frame at the progress increment provided. /// </summary> /// <param name="baseValue">The value to animate from; typically the value of the previous key frame.</param> /// <param name="splineProgress"> /// A value between 0.0 and 1.0, inclusive, that specifies the percentage of time /// that has elapsed for this key frame. /// The <see cref="KeySpline"/> has already been applied to this progress. /// </param> /// <returns>The output value of this key frame given the specified base value and progress.</returns> protected override Brush InterpolateValueWithSplineProgress(Brush baseValue, double splineProgress) { if (splineProgress <= 0) { return(baseValue); } if (splineProgress >= 1) { return(Value); } BrushAnimationValidator.ValidateBrushes(baseValue, Value); return(BrushAnimationHelper.Instance.InterpolateValue(baseValue, Value, splineProgress)); }
/// <summary> /// Validates that the specified brushes satisfy all rules which /// are required for the animation to be able to work. /// </summary> /// <param name="from">The origin brush.</param> /// <param name="to">The destination brush.</param> /// <exception cref="InvalidOperationException"> /// Thrown if one of the validation rules fails. /// </exception> protected override void ValidateAnimationValues(Brush from, Brush to) { BrushAnimationValidator.ValidateBrushes(from, to); }