static function Lerp (from : float, to : float, t : float) : float
Description描述
Interpolates a towards b by t. t is clamped between 0 and 1.
基于浮点数t返回a到b之间的插值,t限制在0~1之间。
When t = 0 returns from. When t = 1 return to. When t = 0.5 returns the average of a and b.
当t = 0返回from,当t = 1 返回to。当t = 0.5 返回from和to的平均值。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float minimum = 10.0F;
public float maximum = 20.0F;
void Update() {
transform.position = new Vector3(Mathf.Lerp(minimum, maximum, Time.time), 0, 0);
}
}