毕业论文 论文提纲 论文写作 公文范例 教育论文 教育学论文 师范教育 学术论文     论文指导*
                     
 
   
   
   
   
           
 

当前位置:课件115学培吧(kj115.com)→flash网侠教程(助你成为顶尖课件高手)→系列文章

 
 
标题:用Flash AS编写蝌蚪摆尾特效动画
 
展示台

文章来源 作者:admin 密码:admin 整理:湖北金鹰

◇网侠教程栏目简介
    提供FLASH侠客教程和网页制作侠客教程,高手进阶教程。
    浏览过这些资源的还浏览过经典教程图文教程游戏开发教程等相关资源。

---------------

湖北金鹰课件吧

论文相关服务
 

 

本文中我们用Flash 的 AS代码来编写一个蝌蚪自由摆尾游动的动画。
场景里代码:
Object.environment = this;
Math.prototype.degrees = function (r)
{
return (r * 180 / 3.141593E+000);
};
maxtents = 3;
this.onEnterFrame = function ()
{
if (!random(30) && tents < maxtents)
{
var nombre = "tent" + String(depth++);
var neo = this.attachMovie("tentacle", nombre, depth);
neo._x = random(600);
neo._y = 370;
neo.theta = 270;
++tents;
} // end if
};
stop ()
MC里的代码:
#initclip 1
function TentacleClass()
{
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);
this.muscleFreq = 1.000000E-001 + random(100) / 250;
this.generateNodes();
this.onEnterFrame = this.move;
} // End of the function
TentacleClass.prototype = new MovieClip();
TentacleClass.prototype.generateNodes = function ()
{
this.node = new Array();
var n = 0;
while (n < this.numNodes)
{
var point = {x: 0, y: 0};
this.node.push(point);
++n;
} // end while
};
TentacleClass.prototype.move = function ()
{
this.tv = this.tv + 5.000000E-001 * (Math.random() - Math.random());
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 = -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));
var i = 2;
while (i < this.numNodes)
{
var dx = this.node.x - this.node[i - 2].x;
var dy = this.node.y - this.node[i - 2].y;
var d = Math.sqrt(dx * dx + dy * dy);
this.node.x = this.node[i - 1].x + dx * this.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 this._x - this._width > 600 this._y + this._height < 0 this._y - this._height > 400)
{
--Object.environment.tents;
this.removeMovieClip();
} // end if
} // end if
++i;
} // end while
this.clear();
this.moveTo(this.node[1].x, this.node[1].y);
var i = 2;
while (i < this.numNodes)
{
this.lineStyle(int(this.numNodes - i) * (this.numNodes - i) / 20, 16777215, 100);
this.lineTo(this.node.x, this.node.y);
++i;
} // end while
};
Object.registerClass("tentacle", TentacleClass);
#endinitclip

 

 

 
课件115学培吧(湖北金鹰)欢迎您!永久免费服务网址:http://www.kj115.com
   
 

学员众多的FLASH课件学习基地,成万免费FLASH课件制作教程在线学习,还有免费内容课件教程、视频教程、课件技巧、课件探讨、课件欣赏、课件展示、实用教程、课件界面、课件脚本、课件游戏、课件下载、课件封面、课文内容图片、课文人物图片库、课件素材、图片素材、声音素材、动物素材、背景图片、背景资料、背景边框、课件顶栏图片素材、Dreamweaver教程、Dreamweaver网页课件教程、软件下载。承接学习和培训,承接课件订制,课件修改等所有课件相关服务。
本站主要业务:┃flash课件制作视频教程培训┃承接全国竞赛flash课件┃论文代写代发┃代办课件国家级获奖证书┃
联系:QQ:444860709 手机:13339817386


 
 

业务办理
鄂ICP备08005724号