Mathf
- Abs
- Acos
- Approximately
- Asin
- Atan2
- Atan
- CeilToInt
- Ceil
- Clamp01
- Clamp
- ClosestPowerOfTwo
- Cos
- Deg2Rad
- DeltaAngle
- Epsilon
- Exp
- FloorToInt
- Floor
- Infinity
- InverseLerp
- IsPowerOfTwo
- LerpAngle
- Lerp
- Log10
- Log
- Max
- Min
- MoveTowardsAngle
- MoveTowards
- NegativeInfinity
- NextPowerOfTwo
- PingPong
- PI
- Pow
- Rad2Deg
- Repeat
- RoundToInt
- Round
- Sign
- Sin
- SmoothDampAngle
- SmoothDamp
- SmoothStep
- Sqrt
- Tan
Mathf.Lerp 插值
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);
}
}
最后修改:2011年2月23日 Wednesday 14:09