public override Color GetValue(IKeyframe <Color> keyframe, float keyframeProgress) { if (keyframe.StartValue == null || keyframe.EndValue == null) { throw new System.InvalidOperationException("Missing values for keyframe."); } var startColor = keyframe.StartValue; var endColor = keyframe.EndValue; return(GammaEvaluator.Evaluate(keyframeProgress, startColor, endColor)); }
internal virtual void Lerp(GradientColor gc1, GradientColor gc2, float progress) { if (gc1._colors.Length != gc2._colors.Length) { throw new System.ArgumentException("Cannot interpolate between gradients. Lengths vary (" + gc1._colors.Length + " vs " + gc2._colors.Length + ")"); } for (var i = 0; i < gc1._colors.Length; i++) { _positions[i] = MiscUtils.Lerp(gc1._positions[i], gc2._positions[i], progress); var gamma = GammaEvaluator.Evaluate(progress, gc1._colors[i], gc2._colors[i]); _colors[i] = gamma; } }