44 lines
1.1 KiB
C#
44 lines
1.1 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Beyond
|
|
{
|
|
public class ImageColorPingPong : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Image m_image;
|
|
[SerializeField]
|
|
[ColorUsageAttribute(true, true, 0f, 8f, 0.125f, 3f)]
|
|
private Color m_Color1 = Color.black;
|
|
[SerializeField]
|
|
[ColorUsageAttribute(true, true, 0f, 8f, 0.125f, 3f)]
|
|
private Color m_Color2 = Color.white;
|
|
|
|
[SerializeField] private float m_time = 0.5f;
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
if (m_image == null)
|
|
m_image = GetComponent<Image>();
|
|
if (m_image == null)
|
|
{
|
|
Debug.LogError("Image is null", this);
|
|
enabled = false;
|
|
return;
|
|
}
|
|
m_image.color = m_Color1;
|
|
m_image.DOColor(m_Color2, m_time).SetLoops(-1, LoopType.Yoyo);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|