//创建一个影片剪辑“y_mc”
onEnterFrame = function () {
vx = _xmouse-y_mc._x;
vy = _ymouse-y_mc._y;
digree = Math.atan(vy/vx)*180/Math.PI;
//“Math.atan(vy/vx)”得到弧度,“*180/Math.PI”转成度数。
//判断各种不同的情况,通过运算使digree值在0-360之间
if (vy>=0 && vx>=0) {
digree = digree;
} else if (vx>=0 && vY<=0) {
digree = 360+digree;
} else {
digree = 180+digree;
}
y_mc._rotation = digree+90;//为什么要加90才能实现呢?谁能告诉我?
};
Flash 动画:
onEnterFrame = function () {
vx = _xmouse-y_mc._x;
vy = _ymouse-y_mc._y;
digree = Math.atan(vy/vx)*180/Math.PI;
//“Math.atan(vy/vx)”得到弧度,“*180/Math.PI”转成度数。
//判断各种不同的情况,通过运算使digree值在0-360之间
if (vy>=0 && vx>=0) {
digree = digree;
} else if (vx>=0 && vY<=0) {
digree = 360+digree;
} else {
digree = 180+digree;
}
y_mc._rotation = digree+90;//为什么要加90才能实现呢?谁能告诉我?
};
Flash 动画:
回复Comments
作者:
{commentrecontent}