2026-01-12 09:36:17 +03:00

28 lines
573 B
C#

using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(TextMeshProUGUI))]
public class SinAlphaText : MonoBehaviour
{
[Range(0, 1)] public float amplitude = 0.5f;
public float speed = 1;
TextMeshProUGUI label;
int a;
private void Start()
{
label = GetComponent<TextMeshProUGUI>();
}
void Update()
{
Color c = label.color;
c.a = amplitude + amplitude * Mathf.Sin(Time.time * speed)/2;
label.color = c;
}
}