点击浏览该文件
点击浏览该文件
点击浏览该文件
点击浏览该文件
主要代码就是通过下面的进行一些调整就出来了以上好几种效果:
Stage.scaleMode="noScale";
vardepths=1;
this.createEmptyMovieClip("dot",0);
this.createEmptyMovieClip("l",-1);
with(dot){
lineStyle(1,0xffffff);
lineTo(1,0);
_visible=false;
}
functiondrawLine(){
for(vari=depths;i vard=dot.duplicateMovieClip("dot"+i,i,{_x:random(400),_y:random(400),a:0}); line=l.createEmptyMovieClip("line"+i,i); line.clear(); line.lineStyle(1,0xffffff); line.moveTo(d._x,d._y); d.onEnterFrame=function(){ this.a+=5; this.dx=posx-this._x; this.dy=posy-this._y; this.dis=Math.sqrt(this.dx*this.dx+this.dy*this.dy); this.r=Math.atan2(this.dy,this.dx); this._x+=this.dx/7-Math.sin(this.r)*this.dis/7*Math.sin(this.a*2); this._y+=this.dy/7+Math.cos(this.r)*this.dis/7*Math.sin(this.a*2); this._parent.l["line"+this._name.substr(3)].lineStyle(1,0xff0000,this.a); this._parent.l["line"+this._name.substr(3)].lineTo(this._x,this._y); if(Math.abs(this._x-posx)<1andMath.abs(this._y-posy)12?1:depths+4; }; //as区已加分:)

