-
Notifications
You must be signed in to change notification settings - Fork 0
/
TweenTextColor.cs
42 lines (36 loc) · 906 Bytes
/
TweenTextColor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using UnityEngine;
using UnityEngine.UI;
namespace cpGames.core.Tweening
{
public class TweenTextColor : Tween
{
#region Fields
private Color _colorStart;
private Text _text;
public Color colorFrom;
public Color colorTo;
#endregion
#region Properties
public Color Color => _text.color;
#endregion
#region Methods
protected override void Awake()
{
_text = target.GetComponent<Text>();
_colorStart = _text.color;
}
protected override void Transition(float val)
{
_text.color = Color.Lerp(colorFrom, colorTo, val);
}
public override void Reset()
{
base.Reset();
if (_text != null)
{
_text.color = _colorStart;
}
}
#endregion
}
}