◆ ◆ ◆
Other Math
degreesToRadians(度数)
将度转换为弧度。
//返回 3.1415926
degreesToRadians(180)
radiansToDegrees(弧度)
将弧度转换为度。
//返回 180
radiansToDegrees(Math.PI)
◆ ◆ ◆
JavaScript Math
//返回形状图层的锚点的方位角度数
y = thisComp.layer("形状图层 1").transform.position[1];
x = thisComp.layer("形状图层 1").transform.position[0];
radiansToDegrees(Math.atan2(y, x));
//计算两个图形之间的距离
layer1 = thisComp.layer("形状图层 1").transform.position;
layer2 = thisComp.layer("形状图层 2").transform.position;
Math.sqrt(Math.pow(layer2[0]-layer1[0],2)+Math.pow(layer2[1]-layer1[1],2));
//相当于 length(layer1,layer2);
Math.ceil(x)
//返回 4
Math.ceil(3.5)
//返回 3
Math.floor(3.5)
联系客服