Rework latest version stuff and add splash texts & more
This commit is contained in:
@@ -7,16 +7,23 @@ public class BouncyText : MonoBehaviour
|
||||
[SerializeField] private float frequency = 2f;
|
||||
[SerializeField] private float minSize = 10f;
|
||||
[SerializeField] private float maxSize = 12f;
|
||||
[SerializeField] private bool add;
|
||||
private TextMeshProUGUI text;
|
||||
private float startSize = 0;
|
||||
|
||||
void Start()
|
||||
void Awake()
|
||||
{
|
||||
text = GetComponent<TextMeshProUGUI>();
|
||||
if (add)
|
||||
{
|
||||
startSize = text.fontSize;
|
||||
text.enableAutoSizing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
float newsize = (Mathf.Sin(Time.time * frequency) + 1f) / 2f;
|
||||
text.fontSize = Mathf.Lerp(minSize, maxSize, newsize);
|
||||
text.fontSize = Mathf.Lerp(add ? startSize : minSize, maxSize + (add ? startSize : 0), newsize);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user