how to lerp unity code example
Example 1: unity lerp
thisText.color = Color.Lerp(normalColour, noAlpha, (Time.time - startTime) / lifeTime);
Example 2: unity lerp
using UnityEngine;
using System.Collections;public class ExampleClass : MonoBehaviour
{
public Transform startMarker;
public Transform endMarker;
public float speed = 1.0F;
private float startTime;
private float journeyLength; void Start()
{
startTime = Time.time;
journeyLength = Vector3.Distance(startMarker.position, endMarker.position);
}
void Update()
{
float distCovered = (Time.time - startTime) * speed;
float fractionOfJourney = distCovered / journeyLength;
transform.position = Vector3.Lerp(startMarker.position, endMarker.position, fractionOfJourney);
}
}
Example 3: how to lerp a value in unity
lerpValue = Mathf.Lerp(minValue, maxValue, interpolationPoint);