lucid-super-dream/Assets/Scripts/ScaleWithTime.cs

30 lines
778 B
C#
Raw Normal View History

2021-01-10 17:51:34 +01:00
using System;
using System.Collections;
using System.Collections.Generic;
using Ktyl.Util;
using TMPro;
using UnityEngine;
public class ScaleWithTime : MonoBehaviour
{
[SerializeField] private SerialFloat timeSince;
[SerializeField] private float scale = 1.5f;
[SerializeField] private float ySquish = -0.15f;
[SerializeField] private float characterSpacing = 10f;
private TextMeshProUGUI _text;
private void Awake()
{
2021-01-11 11:01:41 +01:00
_text = GetComponentInChildren<TextMeshProUGUI>();
2021-01-10 17:51:34 +01:00
}
// Update is called once per frame
void Update()
{
_text.characterSpacing = timeSince * timeSince * characterSpacing;
transform.localScale = new Vector3(1 + timeSince*timeSince * scale, 1 + timeSince*timeSince * ySquish, 1);
}
}