如何将角度和坐标标准化

将角度和坐标标准化,可以大大的提高影片制作的水平与速度,下面我来介绍一下这个方法:
_root.createEmptyMovieClip("line", 0);
//建立一个空的电影剪辑
_root.onEnterFrame = function() {
mc._x = _xmouse;
mc._y = _ymouse;
//定义MC的坐标为鼠标的坐标
x = _xmouse-100;
y = -(_ymouse-100);
//这里用负的是将FLASH的坐标换回一般的坐标
//这里就是将坐标中心移到了中心(舞台是200*200)
with (_root.line) {
clear();
lineStyle(1);
moveTo(100, 100);
lineTo(_xmouse, _ymouse);
lineTo(_xmouse, 100);
//动态画线
}
m = Math.atan2(y, x);
//这里是返回角的弧度    r = (m*180)/Math.PI;
//这里返回角度
if (r<0) {
r = r+360;
//这里将角度化为在0--360之间
}
angle = "角度="+Math.round(r);
n = "x="+x+"y="+y;
//返回舞台的文本框
};
_root.createEmptyMovieClip("line", 0);
//建立一个空的电影剪辑
_root.onEnterFrame = function() {
mc._x = _xmouse;
mc._y = _ymouse;
//定义MC的坐标为鼠标的坐标
x = _xmouse-100;
y = -(_ymouse-100);
//这里用负的是将FLASH的坐标换回一般的坐标
//这里就是将坐标中心移到了中心(舞台是200*200)
with (_root.line) {
clear();
lineStyle(1);
moveTo(100, 100);
lineTo(_xmouse, _ymouse);
lineTo(_xmouse, 100);
//动态画线
}
m = Math.atan2(y, x);
//这里是返回角的弧度
r = (m*180)/Math.PI;
//这里返回角度
if (r<0) {
r = r+360;
//这里将角度化为在0--360之间
}
angle = "角度="+Math.round(r);
n = "x="+x+"y="+y;
//返回舞台的文本框
};

Need a translation service?

Please enter your personal details and we will contact you shortly

Words translated by CCJK

146,096,379

We are Certified

Our Client Satisfaction

rating for previous quarte

4.00

Over 95% of our clients recommend our language services to others

Copyright © CCJK Technologies Co., Ltd. 2000-2017. All rights reserved.
TOP