用Flash脚本生成的花朵

2008-04-02 10:56:11来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折


  今天无聊给大家讲个新玩意吧!假如有点程式基础的看看下面的,重要的我已解释过半,flash 8.0勿试!效果:(能够用鼠标连续点击)

  

  


  先看看下面的代码:

  
// [Action in Frame 1]

  function initFlower()//init一个在开始循环序列前要计算的表达式/init(初始化)表达式

  {

  FLOOR_POS = flowerDot_mc._y - 1;

  fNum = -1;

  tipScale = growScale = tipSlow = growSlow = 0;//开始了

  flower = false;//花儿

  growing = true;//生长

  flowerDot_mc._visible = false;

  tip = new Array();//记录叶子的数组

  c1 = new Array();

  c2 = new Array();

  m1 = new Array();

  m2 = new Array();

  c3 = new Array();

  c4 = new Array();

  this.createEmptyMovieClip("flower_mc", 0);

  flower_mc._x = flowerDot_mc._x;

  leafTotal = int(rnd() * 5) 3;//rnd函数在使用中能够用语句Randomize进行初始化

  leafLength = rnd() * 80 20;

  leafWidth = leafLength / leafTotal * 3.141593 * rnd();

  leafNextNum = leafNum = int(rnd() * leafColor.length);

  petalNextNum = petalNum = int(rnd() * petalColor.length);

  midNum = int(rnd() * midColor.length);

  flower_color = new Color("flowerDot_mc");

  flower_color.setRGB(leafLine[leafNum]);

  } // End of the function

  function newFlower()

  {

  flowerDot_mc._visible = true;

  if (fNum == 1)

  {

  flower = true;

  } // end if

  if (fNum == 2)

  {

  growing = false;

  return(undefined);

  } // end if

  fNum ;

  flower_mc.createEmptyMovieClip(fNum, fNum).createEmptyMovieClip("stem_mc", -1);

  flower_mc[fNum].ox = 0;

  flower_mc[fNum].oy = fNum == 0 ? (FLOOR_POS) : (flower_mc[fNum - 1].oy);

  tip[fNum] = new Array();

  c1[fNum] = new Array();

  c2[fNum] = new Array();

  m1[fNum] = new Array();

  m2[fNum] = new Array();

  c3[fNum] = new Array();

  c4[fNum] = new Array();

  var _l18 = rnd() * 1.500000;

  var _l17 = rnd() * 1.500000;

  var _l16 = rnd() * 1.500000;

  var _l14 = rnd() * 0.400000 0.200000;

  var _l13 = rnd() * 0.400000 0.600000;

  var _l15 = rnd() * 0.900000 0.100000;

  if (_l15 < 0.200000)

  {

  _l14 = 0;

  _l13 = 0;

  _l15 = 0;

  } // end if

  if (flower)

  {

  var _l24 = rnd() * 80 - 100;

  var _l21 = 0;

  var _l23 = rnd() * 100 - 50;

  var _l22 = 0;

  leafTotal = int(rnd() * 7) 3;

  leafLength = rnd() * 80 20;

  leafWidth = leafWidth 20;

  }

  else

  {

  _l24 = rnd() * 80 - 40;

  _l21 = rnd() * 40 - 20;

  _l23 = rnd() * 40 - 20;

  _l22 = rnd() * 30 - 15;

  } // end if

  tipScale = 0;

  tipSlow = 0.050000;

  growScale = 0.250000;

  growSlow = 0.050000;

  var _l1 = leafTotal;

  while (_l1--)

  {

  var _l7 = _l1 / leafTotal * 6.283185;

  tip[fNum][_l1] = new Vertex(cos(_l7) * leafLength, sin(_l7) * leafLength, _l24);

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇: Flash绘画教程:漫画中的特别技法介绍

下一篇: ActionScript入门学习-声音的控制