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 生日广州男生祝福语简短