Lerp by Timer Unity
float lerpDuration = 3;
float startValue = 0;
float endValue = 10;
float valueToLerp;
void Start()
{
StartCoroutine(Lerp());
}
IEnumerator Lerp()
{
float timeElapsed = 0;
while (timeElapsed < lerpDuration)
{
valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);
timeElapsed += Time.deltaTime;
yield return null;
}
valueToLerp = endValue;
}
Annoyed Angelfish