Unity 3D 中的线性插值Lerp()函数解析 在unity3D 中经常用线性插值函数Lerp()来在两者之间插值,两者之间可以是两个材质之间、两个向量之间、两个浮点数之间、两个颜色之间,其函数原型如下: Material
Lerp 插值 function Lerp (start : Material, end : Material, t : float) : void 在两个材质之间插值 Vector2
Lerp 插值 static function Lerp (from : Vector2, to : Vector2, t : float) : Vector2 两个向量之间的线性插值
按照数字 t 在form 到 to 之间插值
t 是夹在0 到 1 之间
当 t=0 时,返回 from
当 t=1 时,返回 to
5 时放回 from和 to 之间的平均数
Vector3
Lerp 插值 static function Lerp (from : Vector3, to : Vector3, t : float) : Vector3 两个向量之间的线性插值
按照数字 t 在from 到 to 之间插值
Vector4
Lerp 插值 static function Lerp (from : Vector4, to : Vector4, t : float) : Vector4 两个向量之间的线形插值
按照数字 t 在from 到 to 之间插值
t 是夹在[0
1]之间的值
,当 t = 0 时,返回 from
当 t = 1 时,返回 to
当 t = 0
5 返回 from 和 to 的平均数
Lerp 插值 static function Lerp (from : float, to : float, t : float)