Thứ Bảy, 14 tháng 8, 2010

Hiệu ứng ngôi sao rơi




B1: Insert symbol, type MovieClip, vẽ 1 ngôi sao, convert nó sang graphic, tạo 3 keyframe và scale tại keyframe giữa 150%.

B2: Đặt linkage cho MovieClip đó là "star"

B3: Ra ngoài Stage và viết đoạn code sau đây lên frame:

Code:
i = 0;
soLuong = 100;
function createStar() {
 _root.attachMovie("star", "star"+i, i);
 scale = random(60)+10;
 _root["star"+i]._x = Math.random()*Stage.width;
 _root["star"+i]._xscale = scale;
 _root["star"+i]._yscale = scale;
 _root["star"+i].yspeed = Math.random()*3+1;
 _root["star"+i].onEnterFrame = function() {
  if (this._y>Stage.height) {
   this._x = Math.random()*Stage.width;
   this._y = 0;
  } else {
   this._y += this.yspeed;
  }
 };
 i = (i<soLuong) ? i+1 : 0;
}
setInterval(createStar, 100);


Rar file: http://www.vietdetroit.com/dantopaz/...llingStars.rar

Không có nhận xét nào:

Đăng nhận xét