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.InverseLerp 反插值
static function InverseLerp (from : float, to : float, value : float) : float
Description描述
Calculates the Lerp parameter between of two values.
计算两个值之间的Lerp参数。也就是value在from和to之间的比例值。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public float walkSpeed = 5.0F;
public float runSpeed = 10.0F;
public float speed = 8.0F;
void Start() {
float parameter = Mathf.InverseLerp(walkSpeed, runSpeed, speed);
}
}
var walkSpeed = 5.0;
var runSpeed = 10.0;
var speed = 8.0;
function Start() {
// parameter is now 3 / 5
//现在参数是3/5
var parameter : float = Mathf.InverseLerp(walkSpeed, runSpeed, speed);
}
最后修改:2011年2月23日 Wednesday 22:25