Format again
This commit is contained in:
93 files changed
+7328
-7323
No files matched your search
@@ -3,24 +3,24 @@ using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(TextMeshProUGUI))]
|
||||
public class BouncyText : MonoBehaviour {
|
||||
public float frequency = 2f;
|
||||
public float minSize = 10f;
|
||||
public float maxSize = 12f;
|
||||
public bool add;
|
||||
private TextMeshProUGUI text;
|
||||
private float startSize = 0;
|
||||
public float frequency = 2f;
|
||||
public float minSize = 10f;
|
||||
public float maxSize = 12f;
|
||||
public bool add;
|
||||
private TextMeshProUGUI text;
|
||||
private float startSize = 0;
|
||||
|
||||
void Awake() {
|
||||
text = GetComponent<TextMeshProUGUI>();
|
||||
if (add) {
|
||||
text.ForceMeshUpdate();
|
||||
startSize = text.fontSize;
|
||||
text.enableAutoSizing = false;
|
||||
}
|
||||
void Awake() {
|
||||
text = GetComponent<TextMeshProUGUI>();
|
||||
if (add) {
|
||||
text.ForceMeshUpdate();
|
||||
startSize = text.fontSize;
|
||||
text.enableAutoSizing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void Update() {
|
||||
float newsize = (Mathf.Sin(Time.time * frequency) + 1f) / 2f;
|
||||
text.fontSize = Mathf.Lerp(add ? startSize : minSize, maxSize + (add ? startSize : 0), newsize);
|
||||
}
|
||||
void Update() {
|
||||
float newsize = (Mathf.Sin(Time.time * frequency) + 1f) / 2f;
|
||||
text.fontSize = Mathf.Lerp(add ? startSize : minSize, maxSize + (add ? startSize : 0), newsize);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user