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 收生日红包祝福语 简短
13 领证幽默祝福语简短
14 法考面试祝福语简短
15 老哥出门祝福语简短语
16 送灯祝福语简短独特
17 幼儿狗年祝福语大全简短
18 好听的元旦简短祝福语