欢迎坐船上岛来雨风的〓◎水中小屋◎〓 看完小屋别忘了来动漫岛论坛逛逛

FLASH中用纯脚本制作雪花效果

上一篇 / 下一篇  2007-06-08 13:42:31 / 个人分类:技术文档

①新建一个FLASH文档,背景色改为黑色。

②在图层一的第一帧在加上代码:
雪花飘落();
function 雪花飘落() {
 import flash.filters.BlurFilter;
 var mc:MovieClip = createEmptyMovieClip("mymc", 0);
 mc._visible = false;
 var 雪花的数量:Number = 60;
 with (mc) {
  beginFill(0xffffff);
  curveTo(2, 8, 5, 0);
  endFill();
 }
 for (var i = 0; i<雪花的数量; i++) {
  this["模糊"+i] = new BlurFilter(Math.floor(i/12), Math.floor(i/12), 3);
  var myArray:Array = new Array(this["模糊"+i]);
  this["雪花的速度"+i] = (i+19)/20;
  mc.duplicateMovieClip("mc"+i, i+1);
  this["mc"+i].filters = myArray;
  with (this["mc"+i]) {
   _x = Math.floor(Math.random()*Stage.width);
   _y = Math.floor(Math.random()*Stage.height);
   _xscale = _yscale=Math.floor(Math.random()*100+20+i);
   _rotation = Math.floor(Math.random()*90);
  }
 }
 onEnterFrame. = function () {
  for (var i = 0; i<雪花的数量; i++) {
   with (this["mc"+i]) {
    _y += this["雪花的速度"+i];
    _rotation += 1;
    if (_y>Stage.height+_height/2) {
     _y = -_height/2;
     //var mycolor:Color = new Color(this["mc"+i]);
     //mycolor.setRGB(Math.random()*0xffffff);
    }
   }
  }
 };
}


TAG:

引用 删除 Guest   /   2008-05-31 17:09:44
5
引用 删除 Guest   /   2008-01-23 21:07:43
5
 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

Open Toolbar