ActionScript 3 沿角度移动点
例子
假设您具有要移动的角度,并且要移动具有x和y值的对象:
var position:Point = new Point(10, 10); var angle:Number = 1.25;
您可以使用以下方法沿x轴移动Math.cos:
position.x += Math.cos(angle);
和y轴一起Math.sin:
position.y += Math.sin(angle);
当然,你可以乘结果Math.cos和Math.sin通过的距离要行程:
var distance:int = 20; position.x += Math.cos(angle) * distance; position.y += Math.sin(angle) * distance;
注意:输入角度必须以弧度为单位。
热门推荐
10 诗词送行祝福语大全简短
11 新房开工吉日祝福语简短
12 50多岁生日简短祝福语
13 安徽疫情祝福语简短英语
14 农民朋友发财祝福语简短
15 对生活祝福语简短精辟
16 搬家词简短祝福语朋友
17 女神结婚快乐祝福语简短
18 文学短句祝福语大全简短