设为首页 加入收藏

TOP

FLASH制作雪花效果(纯脚本)
2012-11-03 15:24:46 来源: 作者: 【 】 浏览:1898次 评论:0
①新建一个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);
    }
   }
  }
};
} 
 
 
Tags:FLASH 雪花 效果 脚本 责任编辑:风花雪月
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到QQ空间
分享到: 
上一篇IE 中的Flash出现激活框的解决方法 下一篇时间轴窗口

评论

帐  号:
密码: (新用户注册)
验 证 码:
表  情:
内  容:

相关栏目

最新文章

图片主题

热门文章

推荐文章

相关文章