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
}
setInterval(createStar, 100);


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


Theo vnfx

1 comments:

An Thuyên said...

nếu muốn cho ngôi sao từ dưới lên thì thay đổi như thế nào ạ

Post a Comment