summaryrefslogtreecommitdiff
path: root/Assets/UI_Extension/Scripts/Animation/Tween/TweenModule_Alpha.cs
blob: 34d6abb9f5b2d1f01b7b10b10a4c84a69dde4fe3 (plain)
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
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace TweenAnimation
{
    [Serializable]
    public class TweenAlpha : TweenModule
    {
        public float from;
        public float to;
        public Graphic graphic;

        protected override void SetValue(float time)
        {
            float t = time / duration;
            float alpha = Mathf.Lerp(from, to, t);
            if (graphic != null)
            {
                Color c = graphic.color;
                c.a = alpha;
                graphic.color = c;
            }
        }

#if UNITY_EDITOR
        public override string name { get { return "Alpha"; } }

#endif

    }
}