就这样了:
Flash 动画:
--------------------------------------------
aa._visible = false;
d = 0;
dis = 0.2;
demp = 0.8;
sx = sy=0;
oldx=new Array()
oldy=new Array()
for (var i = 0; i<6; i++) {
duplicateMovieClip(aa, "aa"+i, i+10);
duplicateMovieClip(line, "line"+i, i);
_root["aa"+i]._y = aa._y+i*60;
_root["aa"+i]._x = 50-random(100)+aa._x;
oldx[i] = _root["aa"+i]._x
oldy[i] = _root["aa"+i]._y
}
_root.onEnterFrame = function() {
for (var i = 1; i<6; i++) {
a = _root["aa"+i]._x-_root["aa"+(i-1)]._x;
b = _root["aa"+i]._y-_root["aa"+(i-1)]._y;
if (a>0 and b>0) {
d = Math.PI;
} else if (a>0 and b<0) {
d = -Math.PI;
} else {
d = 0;
}
_root["line"+i]._rotation = (Math.atan(b/a)+d)*180/Math.PI;
_root["line"+i]._xscale = _root["line"+i]._yscale=((Math.sqrt(a*a+b*b))/281)*100;
_root["line"+i]._x = _root["aa"+(i-1)]._x+a;
_root["line"+i]._y = _root["aa"+(i-1)]._y+b;
if (_root["aa"+i].hitTest(_root._xmouse, _root._ymouse, true)) {
_root["aa"+i]._x = _root._xmouse;
_root["aa"+i]._y = _root._ymouse;
} else {
ax = (oldx[i]-_root["aa"+i]._x)*dis;
ay = (oldy[i]-_root["aa"+i]._y)*dis;
sx += ax;
sy += ay;
sx *= demp;
sy *= demp;
_root["aa"+i]._x += sx;
_root["aa"+i]._y += sy;
}
}
};
-----------
aa是mc的实例名称
Flash 动画:
--------------------------------------------
aa._visible = false;
d = 0;
dis = 0.2;
demp = 0.8;
sx = sy=0;
oldx=new Array()
oldy=new Array()
for (var i = 0; i<6; i++) {
duplicateMovieClip(aa, "aa"+i, i+10);
duplicateMovieClip(line, "line"+i, i);
_root["aa"+i]._y = aa._y+i*60;
_root["aa"+i]._x = 50-random(100)+aa._x;
oldx[i] = _root["aa"+i]._x
oldy[i] = _root["aa"+i]._y
}
_root.onEnterFrame = function() {
for (var i = 1; i<6; i++) {
a = _root["aa"+i]._x-_root["aa"+(i-1)]._x;
b = _root["aa"+i]._y-_root["aa"+(i-1)]._y;
if (a>0 and b>0) {
d = Math.PI;
} else if (a>0 and b<0) {
d = -Math.PI;
} else {
d = 0;
}
_root["line"+i]._rotation = (Math.atan(b/a)+d)*180/Math.PI;
_root["line"+i]._xscale = _root["line"+i]._yscale=((Math.sqrt(a*a+b*b))/281)*100;
_root["line"+i]._x = _root["aa"+(i-1)]._x+a;
_root["line"+i]._y = _root["aa"+(i-1)]._y+b;
if (_root["aa"+i].hitTest(_root._xmouse, _root._ymouse, true)) {
_root["aa"+i]._x = _root._xmouse;
_root["aa"+i]._y = _root._ymouse;
} else {
ax = (oldx[i]-_root["aa"+i]._x)*dis;
ay = (oldy[i]-_root["aa"+i]._y)*dis;
sx += ax;
sy += ay;
sx *= demp;
sy *= demp;
_root["aa"+i]._x += sx;
_root["aa"+i]._y += sy;
}
}
};
-----------
aa是mc的实例名称
回复Comments
作者:
{commentrecontent}