js数学函数:
<!DOCTYPE HTML>
<html>
<body>
<script>
//弧度 = π/180×角度
//角度 = 180/π×弧度
var hd = Math.PI / 180 * 30 ;
var jd = 180/Math.PI * hd;
//角度 = 180/Math.PI * Math.asin(1/2)
console.log(Math.sin(Math.PI/180*30));
</script>
</body>
</html>
cocos creator数学函数 :
// 合成基于X正方向的方向向量
var dir = cc.v2(Math.cos(hd), Math.sin(hd));
// 单位化向量
dir.normalizeSelf();