Flash AS教程:蝌蚪摆尾动画

所属分类: 媒体动画 / Flash教程 阅读数: 53
收藏 0 赞 0 分享
本例介绍使用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 ()


  #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
更多精彩内容其他人还在看

Flash cs3绘制人物高级行走动画教程

本教程向大家介绍Flash cs3绘制人物高级行走动画效果,教程难度不是很大,绘制方法及过程介绍的也非常详细,教程很实用,转发过来,希望大家喜欢
收藏 0 赞 0 分享

Flash CS4来制作漂亮的气泡动画教程

本教程向脚本之家的朋友介绍用Flash CS4来制作漂亮的气泡动画,制作出来气泡真的很好看,制作效果是采用代码形式实现,觉得很不错,转发过来,感兴趣的朋友可以一起来学习
收藏 0 赞 0 分享

flash基础教程:帧、关键帧、空白帧概念及区别介绍

动画的产生是帧来实现的,那什么是帧?帧、关键帧和空白帧之间又有什么区别?本文就为大家介绍一下三者之间的关系
收藏 0 赞 0 分享

Flash教程:动画背景的绘制方法之透视篇(给新手)

Flash动画在网络上的广泛传播,已经成为上网一族喜闻乐见的一种艺术形式。动画背景的绘制方法有很多,也有很多表现方法。这里将结合透视学的基础知识向大家简单的介绍一下动画背景的绘制。
收藏 0 赞 0 分享

Flash AS入门教程:Flash AS3.0制作有年份有日期的时钟

本教程是向大家介绍利用Flash AS3.0制作有年份有日期的时钟,虽然制作时钟老套了点,但它确可以较全面地应用到时间日期和间隔等知识,仍不失为较好的入门练习,转发给大家,希望对大家有所帮助
收藏 0 赞 0 分享

Flash相册制作大师具体该如何使用 Flash相册制作大师使用教程

在本文中我们将会看到的是Flash相册制作大师的具体使用的方法
收藏 0 赞 0 分享

flash基础教程:混色器面板图文介绍

混色器面板是Flash中用于色彩处理的一个重要面板,熟练地使用该面板,可以帮助用户快速地完成色彩的填充,编辑出色彩丰富的图形。本教程为大家详细介绍一下混色器面板,希望对大家有所帮助
收藏 0 赞 0 分享

25个绝对让你应接不暇的Flash网站创意

在Web设计过程中,运用成熟的Flash技术可以把你任意想到的idea表现到产品页面中。这里为你整理发现了25个绝对让你应接不暇的 Flash网站创意,更好地体现网站的互动应用,同时可以让你大饱眼福,一起来欣赏吧
收藏 0 赞 0 分享

教你用Flash制作非常酷的二进制时钟动画

今天在这个教程中我们将学习用Flash做一个不同寻常的,但非常酷的时钟:一个二进制时钟,中间用到了代码,但介绍地很详细,相信很值得大家学习
收藏 0 赞 0 分享

Flash动画特效制作技巧:制作超酷的文字炸开动画效果

本教程向大家介绍Flash动画特效制作技巧,本实例是制作文字炸开的动画效果,制作效果非常酷,制作过程也比较简单,喜欢的朋友可以过来学习一下这种制作方法
收藏 0 赞 0 分享
查看更多