欢迎来到天天文库
浏览记录
ID:24293671
大小:56.00 KB
页数:3页
时间:2018-11-13
《用flash as编写的蝌蚪特效动画》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、用FlashAS编写的蝌蚪特效动画效果查看:点击这里下载源文件场景里代码:Object.environment=this;Math.prototype.degrees=function(r){return(r*180/3.141593E+000);};maxtents=3;this.onEnterFrame=function(){if(!random(30)tents<maxtents){varnombre="tent"+String(depth++);varneo=this.attachMovie("tentacle",nombre,depth);neo._x=ra
2、ndom(600);neo._y=370;neo.theta=270;++tents;}//endif};stop();MC里的代码:#initclip1functionTentacleClass(){this.numNodes=27;this.head=2+random(4);this.girth=8+random(12);this.speedCoefficient=9.000000E-002+random(10)/50;this.friction=9.000000E-001+random(10)/100;this.muscleRange=20+random(50);th
3、is.muscleFreq=1.000000E-001+random(100)/250;this.generate123下一页[感谢阅读这篇文章,..,]Nodes();this.onEnterFrame=this.move;}//EndofthefunctionTentacleClass.prototype=neNodes){varpoint={x:0,y:0};this.node.push(point);++n;}//endove=function(){this.tv=this.tv+5.000000E-001*(Math.random()-Math.random())
4、;this.theta=this.theta+this.tv;this.tv=this.tv*this.friction;this.node[0].x=this.head*Math.cos(1.745329E-002*this.theta);this.node[0].y=this.head*Math.sin(1.745329E-002*this.theta);this.count=this.count+this.muscleFreq;this.thetaMuscle=this.muscleRange*Math.sin(this.count);this.node[1].x=-
5、this.head*Math.cos(1.745329E-002*(this.theta+this.thetaMuscle));this.node[1].y=-this.head*Math.sin(1.745329E-002*(this.theta+this.thetaMuscle));vari=2;Nodes){vardx=this.node.x-this.node[i-2].x;vardy=this.node.y-this.node[i-2].y;vard=Math.sqrt(dx*dx+dy*dy);this.node.x=this.node[i-1].x+dx*th
6、is.girth/d;this.node.y=this.node[i-1].y+dy*this.girth/d;if(i==2){this._x=this._x-dx*this.speedCoefficient;this._y=this._y-dy*this.speedCoefficient;if(this._x+this._width<0
7、
8、this._x-this._width>600
9、
10、this._y+this._height<0
11、
12、this._y-this._height>400)&nbs上一页123下一页[感谢阅读这篇文章,..,]p;{--Objec
13、t.environment.tents;this.removeMovieClip();}//endif}//endif++i;}//endoveTo(this.node[1].x,this.node[1].y);vari=2;Nodes){this.lineStyle(int(this.numNodes-i)*(this.numNodes-i)/20,16777215,100);this.lineTo(this.node.x,this.node.y);++i;}//endwhile};Object.register
此文档下载收益归作者所有