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;
注意:输入角度必须以弧度为单位。
热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短