贝塞尔曲线

This commit is contained in:
yhh
2020-07-17 11:07:57 +08:00
parent 13e7737cb9
commit 14cb9cd257
11 changed files with 431 additions and 5 deletions

View File

@@ -58,6 +58,20 @@ class MathHelper {
return value % 2 == 0;
}
/**
* 数值限定在0-1之间
* @param value
*/
public static clamp01(value: number){
if (value < 0)
return 0;
if (value > 1)
return 1;
return value;
}
public static angleBetweenVectors(from: Vector2, to: Vector2){
return Math.atan2(to.y - from.y, to.x - from.x);
}