//Update Alpha private void UpdateAlpha(TweenAlphaObject tween) { float begin = tween.startValue; float finish = tween.tweenValue; float change = finish - begin; float duration = tween.totalTime; float currentTime = Time.time - (tween.startTime + tween.delay); float alpha = Equations.ChangeFloat(currentTime, begin, change, duration, tween.ease); float redColor; float redGreen; float redBlue; if (GetComponent <GUITexture> () != null) { redColor = GetComponent <GUITexture> ().color.r; redGreen = GetComponent <GUITexture> ().color.g; redBlue = GetComponent <GUITexture> ().color.b; GetComponent <GUITexture> ().color = new Color(redColor, redGreen, redBlue, alpha); if (duration == 0) { this.EndTween(tween); GetComponent <GUITexture> ().color = new Color(redColor, redGreen, redBlue, finish); return; } } else { redColor = this.GetComponent <Renderer> ().material.color.r; redGreen = this.GetComponent <Renderer> ().material.color.g; redBlue = this.GetComponent <Renderer> ().material.color.b; this.GetComponent <Renderer> ().material.color = new Color(redColor, redGreen, redBlue, alpha); if (duration == 0) { this.EndTween(tween); this.GetComponent <Renderer> ().material.color = new Color(redColor, redGreen, redBlue, finish); return; } } if (Time.time > tween.startTime + tween.delay + duration) { this.EndTween(tween); } }
public static float Calculate(EasingType easingType, float t, float b, float c, float d) { return(Equations.ChangeFloat(t, b, c, d, (Ease)((int)easingType))); }