Bouncy Bouncy

This commit is contained in:
2025-07-13 22:05:54 -07:00
parent ca0af09aac
commit 8af34427e8
4 changed files with 112 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
using UnityEngine;
using TMPro;
public class BouncyText : MonoBehaviour
{
public float frequency = 2f;
public float minSize = 10f;
public float maxSize = 12f;
private TextMeshProUGUI text;
void Start()
{
text = GetComponent<TextMeshProUGUI>();
}
void Update()
{
float newsize = (Mathf.Sin(Time.time * frequency) + 1f) / 2f;
text.fontSize = Mathf.Lerp(minSize, maxSize, newsize);
}
}