26 lines
499 B
C#
26 lines
499 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class SinAlpha : MonoBehaviour
|
|
{
|
|
[Range(0, 1)] public float amplitude = 0.5f;
|
|
public float speed = 1;
|
|
|
|
Graphic image;
|
|
int a;
|
|
|
|
|
|
private void Start()
|
|
{
|
|
image = GetComponent<Graphic>();
|
|
}
|
|
void Update()
|
|
{
|
|
Color c = image.color;
|
|
c.a = amplitude + amplitude * Mathf.Sin(Time.time * speed)/2;
|
|
image.color = c;
|
|
}
|
|
}
|