public void TweenValue(float tweenPercent) { if (!IsTargetValid) { return; } var newColor = default(Color); newColor.r = TweenMode == ColorTweenMode.Alpha ? StartColor.r : easingFunction(StartColor.r, TargetColor.r, tweenPercent); newColor.g = TweenMode == ColorTweenMode.Alpha ? StartColor.g : easingFunction(StartColor.g, TargetColor.g, tweenPercent); newColor.b = TweenMode == ColorTweenMode.Alpha ? StartColor.b : easingFunction(StartColor.b, TargetColor.b, tweenPercent); newColor.a = TweenMode == ColorTweenMode.RGB ? StartColor.a : easingFunction(StartColor.a, TargetColor.a, tweenPercent); OnColorTween.Invoke(newColor); }
public void TweenValue(float tweenPercent) { if (!IsTargetValid) { return; } var newColor = Color.Lerp(StartColor, TargetColor, tweenPercent); if (TweenMode == ColorTweenMode.Alpha) { newColor.r = StartColor.r; newColor.g = StartColor.g; newColor.b = StartColor.b; } else if (TweenMode == ColorTweenMode.RGB) { newColor.a = StartColor.a; } OnColorTween.Invoke(newColor); }