阅读文章(首页/网页制作/Flash教程/)

两只蝴蝶飞舞动画 Flash制作方法

[日期:2007-11-06] 来源:  作者: [字体: ]

  


  然后分别给“引用”命名实例名为fly0_mc,“引用2”实例名为fly1_mc,辅助的实例名为:transp0、transp1。

  9.新建一个图层改名为action,然后按F9打开动作面板,输入如下动作:

  

probability = 100;

  scene_width = 500;

  scene_height = 290;

  speed = 0.03;

  depth = 15;

  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.transp0.onEnterFrame = function () {

  if (random (probability) == 1) {

  target0X = random (scene_width);

  target0Y = random (scene_height);

  }

  this._visible = 0;

  this.smoothMove (speed, target0X, target0Y);

  };

  _root.transp1.onEnterFrame = function () {

  if (random (probability) == 1) {

  target1X = random (scene_width);

  target1Y = random (scene_height);

  }

  this._visible = 0;

  this.smoothMove (speed, target1X, target1Y);

  };

  _root.fly0_mc.onEnterFrame = function () {

  this.smoothMove (speed, transp0._x, _root.transp0._y);

  this.rotateTo (_root.transp0._x, _root.transp0._y);

  };

  _root.fly1_mc.onEnterFrame = function () {

  this.smoothMove (speed, transp1._x, _root.transp1._y);

  this.rotateTo (_root.transp1._x, _root.transp1._y);

  };

  _root.shadow0_mc.onEnterFrame = function () {

  this.smoothMove (speed, transp0._x, _root.transp0._y+depth);

  this.rotateTo (_root.transp0._x, _root.transp0._y+depth);

  };

  _root.shadow1_mc.onEnterFrame = function () {

  this.smoothMove (speed, transp1._x, _root.transp1._y+depth);

  this.rotateTo (_root.transp1._x, _root.transp1._y+depth);

  };

  动画制作完成,按Ctrl+回车键可以测试动画了



上一页 [1] [2] [3] [4] [5]    
阅读:
录入:blue1000

评论 】 【 推荐 】 【 打印
上一篇:Flash教程:可爱卡通小蜜蜂睡觉了
下一篇:Flash教程:鼠标控制转动地球仪
相关文章      
本文评论
  呵呵,怎么保存呐?   (|筱朶學妹 ,2008-06-21 )
发表评论


点评: 字数
姓名:

  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款