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.PingPong 乒乓
static function PingPong (t : float, length : float) : float
Description描述
PingPongs the value t, so that it is never larger than length and never smaller than 0.
让数值t在 0到length之间往返。t值永远不会大于length的值,也永远不会小于0。
The returned value will move back and forth between 0 and length.
返回值将在0和length之间来回移动。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Update() {
transform.position = new Vector3(Mathf.PingPong(Time.time, 3), transform.position.y, transform.position.z);
}
}
最后修改:2011年2月23日 Wednesday 22:20