新增MathHelper.toInt

This commit is contained in:
YHH
2022-03-12 09:13:06 +08:00
parent 131df181e6
commit 5dca337b92
7 changed files with 22 additions and 18 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ module es {
res.range = this._points.length - 4;
} else {
t = MathHelper.clamp01(t) * this._curveCount;
res.range = Math.floor(t);
res.range = MathHelper.toInt(t);
t -= res.range;
res.range *= 3;
}
+5 -1
View File
@@ -471,7 +471,7 @@ module es {
}
public static floorToInt(f: number) {
return Math.trunc(Math.floor(f));
return this.toInt(Math.floor(f));
}
/**
@@ -675,5 +675,9 @@ module es {
public static fromAngle(angle: number) {
return new Vector2(Math.cos(angle), Math.sin(angle)).normalizeEqual();
}
public static toInt(val: number){
return val>0 ? Math.floor(val):Math.ceil(val);
}
}
}