修复getcomponents获取为空问题
This commit is contained in:
@@ -36,8 +36,24 @@ module es {
|
||||
return rightMin + (value - leftMin) * (rightMax - rightMin) / (leftMax - leftMin);
|
||||
}
|
||||
|
||||
public static lerp(value1: number, value2: number, amount: number) {
|
||||
return value1 + (value2 - value1) * amount;
|
||||
public static lerp(from: number, to: number, t: number) {
|
||||
return from + (to - from) * this.clamp01(t);
|
||||
}
|
||||
|
||||
public static inverseLerp(from: number, to: number, t: number) {
|
||||
if (from < to) {
|
||||
if (t < from)
|
||||
return 0;
|
||||
else if(t > to)
|
||||
return 1;
|
||||
} else {
|
||||
if (t < to)
|
||||
return 1;
|
||||
else if(t > from)
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (t - from) / (to - from);
|
||||
}
|
||||
|
||||
public static clamp(value: number, min: number, max: number) {
|
||||
@@ -50,6 +66,10 @@ module es {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static snap(value: number, increment: number) {
|
||||
return Math.round(value / increment) * increment;
|
||||
}
|
||||
|
||||
/**
|
||||
* 给定圆心、半径和角度,得到圆周上的一个点。0度是3点钟。
|
||||
* @param circleCenter
|
||||
@@ -157,5 +177,6 @@ module es {
|
||||
public static repeat(t: number, length: number) {
|
||||
return t - Math.floor(t / length) * length;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user