diff options
author | chai <chaifix@163.com> | 2021-05-28 20:00:48 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-05-28 20:00:48 +0800 |
commit | 26e4dc3a35d9c778684388de1af8b3f288fe627d (patch) | |
tree | e791e224c2be0dcda69dda2211d213f946b3b2cc /Assets/UI_Extension/Scripts/Animation/Tween/TweenModule_Alpha.cs | |
parent | 3bf862ea76d349c2aec1f71656dd6f41a82650e0 (diff) |
*Tween
Diffstat (limited to 'Assets/UI_Extension/Scripts/Animation/Tween/TweenModule_Alpha.cs')
-rw-r--r-- | Assets/UI_Extension/Scripts/Animation/Tween/TweenModule_Alpha.cs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Assets/UI_Extension/Scripts/Animation/Tween/TweenModule_Alpha.cs b/Assets/UI_Extension/Scripts/Animation/Tween/TweenModule_Alpha.cs new file mode 100644 index 0000000..55ff647 --- /dev/null +++ b/Assets/UI_Extension/Scripts/Animation/Tween/TweenModule_Alpha.cs @@ -0,0 +1,34 @@ +using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace TweenAnimation
+{
+ [Serializable]
+ public class TweenAlpha : TweenModule
+ {
+ public Graphic target;
+ public float from;
+ public float to;
+
+ protected override void SetValue(float time)
+ {
+ float t = time / duration;
+ float alpha = Mathf.Lerp(from, to, t);
+ if (target != null)
+ {
+ Color c = target.color;
+ c.a = alpha;
+ target.color = c;
+ }
+ }
+
+#if UNITY_EDITOR
+ public override string name { get { return "Alpha"; } }
+
+#endif
+
+ }
+}
\ No newline at end of file |