Yesky首页| 产品报价| 行情| 手机 | 数码 | 笔记本 | 台式机 | DIY硬件 | 外设 | 网络 | 数字家庭 | 评测 | 软件 | e时代 | 游戏 | 图片 | 壁纸 | 群乐 | 社区 | 博客 | 下载
软件频道>设计在线>Flash|平面网页Flash视频三维欣赏|设计专题教程素材| 群乐:Vista系统下载
您现在的位置: 天极网 > 软件频道 > 设计在线 > flash > Flash动画实例:美丽蜻蜓飞舞
全文
群乐:Flash

Flash动画实例:美丽蜻蜓飞舞

2007-11-05 07:37 作者: 闪电儿(网页教学网) 出处: 论坛整理 责任编辑:Shiny



  9.新建立一个图层"action",按F9打开动作面板,添加如下AS代码:

probability = 30;
scene_width = 550;
scene_height = 300;
speed = 0.03;
MovieClip.prototype.smoothMove = function (speed, targetx, targety) {
 this._x += speed*(targetx-this._x);
 this._y += speed*(targety-this._y);
};
MovieClip.prototype.rotateTo = function (targetx, targety) {
 var diffX = targetx-this._x;
 var diffY = targety-this._y;
 this._rotation = Math.atan2 (diffY, diffX)*180/Math.PI;
};
_root.transp1.onEnterFrame = function () {
 if (random (probability) == 0) {
  target1X = random (scene_width);
  target1Y = random (scene_height);
 }
 this._visible = 0;
 this.smoothMove (speed, target1X, target1Y);
};
_root.fly1.onEnterFrame = function () {
 this.smoothMove (speed, transp1._x, _root.transp1._y);
 this.rotateTo (_root.transp1._x, _root.transp1._y);
};
_root.transp2.onEnterFrame = function () {
 if (random (probability) == 0) {
  target2X = random (scene_width);
  target2Y = random (scene_height);
 }
 this._visible = 0;
 this.smoothMove (speed, target2X, target2Y);
};
_root.fly2.onEnterFrame = function () {
 this.smoothMove (speed, transp2._x, _root.transp2._y);
 this.rotateTo (_root.transp2._x, _root.transp2._y);
};
_root.transp3.onEnterFrame = function () {
 if (random (probability) == 0) {
  target3X = random (scene_width);
  target3Y = random (scene_height);
 }
 this._visible = 0;
 this.smoothMove (speed, target3X, target3Y);
};
_root.fly3.onEnterFrame = function () {
 this.smoothMove (speed, transp3._x, _root.transp3._y);
 this.rotateTo (_root.transp3._x, _root.transp3._y);
};
_root.transp4.onEnterFrame = function () {
 if (random (probability) == 0) {
  target4X = random (scene_width);
  target4Y = random (scene_height);
 }
 this._visible = 0;
 this.smoothMove (speed, target4X, target4Y);
};
_root.fly4.onEnterFrame = function () {
 this.smoothMove (speed, transp4._x, _root.transp4._y);
 this.rotateTo (_root.transp4._x, _root.transp4._y);
};
_root.transp5.onEnterFrame = function () {
 if (random (probability) == 0) {
  target5X = random (scene_width);
  target5Y = random (scene_height);
 }
 this._visible = 0;
 this.smoothMove (speed, target5X, target5Y);
};
_root.fly5.onEnterFrame = function () {
 this.smoothMove (speed, transp5._x, _root.transp5._y);
 this.rotateTo (_root.transp5._x, _root.transp5._y);
};

  10.时间轴最终效果如下图所示:

  实例讲解完成!原文链接

  如对于本文有任何疑问、意见以及建议,请在文章底部的留言板上留言。

  更多精彩,尽在天极设计在线 design.yesky.com!

电脑美术设计热门专区
电脑美术设计热门专区

设计软件视频教程大全
设计软件视频教程大全
设计软件经典教程
设计软件经典教程
设计人生——数码设计人访谈实录集
设计人生——数码设计人访谈实录集
·精彩设计作品展示
·精彩设计素材
·照片后期处理专区
·设计软件经典专题集粹

网友关注
最新上市
编辑推荐
文章阅读排行
周排行
月排行
欢迎订阅天极网RSS聚合资讯:http://www.yesky.com/index.xml